Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Failes to compile and run Java code on Windows
06-15-2017, 10:58 AM (This post was last modified: 06-15-2017 10:58 AM by jworkorg.)
Post: #1
Failes to compile and run Java code on Windows
A bug report from the user X.Wang (dmelt 1.X):
Running java code Example.java in DataMelt failed with the message:
Quote:JAVA_HOME was not set or JAVA_HOME/bin/javac was not found! Or no JDK installed?
It is recommended to set JAVA_HOME. It will point to JAVA_HOME/bin/javac
Remove this check in macros/user/run_javac.bsh if this is not a problem
Run it! Process macros/users/run_java.bsh
Error:Error: Could not find or load main class Example
Find all posts by this user
Quote this message in a reply
06-15-2017, 11:27 AM (This post was last modified: 06-15-2017 11:45 AM by admin.)
Post: #2
RE: Failes to compile and run Java code on Windows
(06-15-2017 10:58 AM)jworkorg Wrote:  A bug report from the user X.Wang (dmelt 1.X):
Running java code Example.java in DataMelt failed with the message:
Quote:JAVA_HOME was not set or JAVA_HOME/bin/javac was not found! Or no JDK installed?
It is recommended to set JAVA_HOME. It will point to JAVA_HOME/bin/javac
Remove this check in macros/user/run_javac.bsh if this is not a problem
Run it! Process macros/users/run_java.bsh
Error:Error: Could not find or load main class Example

Indeed, this problem is seen on some Windows systems. It will be fixed in dmelt 1.8. To fix this problem in the previous version, do this:

Open the file "macros/user/run_javac.bsh" and replace the line 26:

Quote:if (!ffile.isFile()) {
with
Quote:if if (JAVAHOME == null) {

This will fix this problem. Restart DMelt. In addition, when you run a Java code, make sure that you have synchronized the working directory. This can be done by clicking on the [/quote] located the left-bottom of the editor ("project directory)

admin,
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)