Skip to Main Content

Java APIs

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Unable to execute simple class with 5 lines of code in java 22 version

KAMAL TOct 12 2024 — edited Oct 12 2024

Hello All ,

I am tryting execute .class file from commpant prompt with java 22 version.

I generated class file using IO classes and interfaces.when trying to execute my simple class having main method like below snippet .I see some error in command prompt which can be seen below.

public class PCRMDEA {

void main(String[] var1) {

  System.out.println("Hello World");   

}

}

Error while executing class from CMD : java --enable-preview PCRMDEA

Error: no non-private zero argument constructor found in class PCRMDEA
remove private from existing constructor or define as:
public PCRMDEA()

Note: I do not want to add public constructor in java file because i created .class drieclty from another java file.

Trying to make use of modify .class file directly as part of one of the feautres of ClassFile API given in java 22.

Please let me know if if you need more clarification from my side or what i should try to reolve error mentioned above.

Comments

Hiroshi Tonegawa May 31 2024

追加情報です。

リスナーからエラーメッセージでておりました。ただどうしたら良いのかわかりません。

そのlog(TNSLSNR.log)を添付しました。ここから原因、また対処法など解析できませんでしょうか?

大変困っております。よろしくお願いいたします。

TNSLSNR_496.log

1 - 1

Post Details

Added on Oct 12 2024
2 comments
121 views