Sarada
Sarada

Reputation: 33

ClassNotFoundException: com.sun.net.httpserver.HttpHandler- JAVAFX application with Googledrive data storage

I am developing a JAVAFX application which requires GoogleDrive connectivity inorder to store and retrieve data. Since Java11 doesn't include JAVAFX i have used to mergefx inorder to create a merged JDK with FX library. I am able to run the application in Eclipse latest version without any error and is able to connect with Googledrive via browser. In order to create a standalone version, I have used Jlink to create a JRE. Also to avoid the use of .bat file to execute the application, I have used Launch4j to create a .exe file of application. The .exe file has been created successfully,but while trying to connect with Googledrive, its showing the following error:

Caused by: java.lang.ClassNotFoundException: com.sun.net.httpserver.HttpHandler at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)

Please let me know your suggestions,which will be really helpful.

Upvotes: 2

Views: 965

Answers (1)

John Elliott
John Elliott

Reputation: 43

Assuming you are using the module system, you likely need the following line in module-info.java:

requires jdk.httpserver;

The class may be present but you have to declare use of the module with the class

Upvotes: 2

Related Questions