I hope this helps, but if it doesn't, please don't hesitate to share the error messages and step where it fails here. jGRASP is implemented in Java, and runs on all platforms with a Java Virtual Machine (Java version 1.8 or higher). The "$" in front of the variable tells echo to look for a variable. jGRASP is a lightweight development environment, created specifically to provide automatic generation of software visualizations to improve the comprehensibility of software. You can verify if it was successfully created with echo $JAVA_HOME, echo being a command to display something. Your IDE cant find where your compiler is loaded, hence my guess is it cant build an executable program. The "export" instruction creates an environment variable. This file will be automatically read and its instructions executed when you open your profile. Save, close the file, reboot your laptop.At the end of the file, add the following line : export JAVA_HOME="/Path/to/your/java/home" and replace /Path/to/your/java/home with the path that you got at step 5.Alternatively, you can edit the file in command line with nano. Open the newly created file (it's a hidden file so you will have to show hidden files.Get the path to Java and keep it somewhere : which java.zshrc gives you a "No such file or directory" message, create the file: touch. Look for a file called ".zshrc" in this ~ % ls.Go to your home directory with command cd Chap0106.java:25: package does not exist.Yours is obviously not defined, so let's define it manually : Usually, the path to Java must be defined in a JAVA_HOME environment variable. Try to run caver_analyst with the -jdkhome switch, followed by (I guess) the path to a valid JDK as suggested in your error message. If I am not in the directory, I get errors:Ĭ:\Documents and Settings\Dave\Desktop>c:\j 2sdk1.4.2_ 08\jre\bin \java QueryĮxception in thread "main" seems that you are missing Java environment variable to make your program work. if I am in the directory, it runs OK:Ĭ:\labJava>c:\j2sdk1.4.2_0 8\jre\bin\ java Query jGRASP wedge2: exit code for process is 1.Īgain, same behaviour. java:547)Īt nn ect(Oracle Driver.jav a:347)Īt Connection (Unknown Source) run(Unknow n Source)Īt ller.doPri vileged(Na tive Method)Īt ndClass(Un known Source)Īt Class(Unkn own Source)Īt $AppClass Loader.loa dClass(Unk nown Source)Īt ClassInter nal(Unknow n Source)Īt river.getC onnectionI nstance(Or acleDriver. rror: java/sql/SavepointĪt neClass0(N ative Method)Īt neClass(Un known Source)Īt fi neClass(Un known Source)Īt fineClass( Unknown Source)Īt cess$100(U nknown Source)Īt $1. OK - so the program compiles now, but it won't run. i can't believe i wasted 4 hours on this. I changed it to "Query.java" and it compiles fine now. Notice that the filename was "Query.Java" with a capital "J" on the extension. To resolve this issue, add a path for Java in Environment Variables or use the command from the directory (jdkbin). still no dice:Ĭ:\labJava>javac -g -classpath C:\j2sdk1.4.2_08\jre\lib\e xt -sourcepath c:\labJaĪrrrghhhhhhhh. Path variables may not have been defined. JavaĪnd finally, tried to separate out classpath and sourcepath. Javac: invalid flag: c:\Documents and Settings\Dave\Desktop\labJ ava\Query. Tried to use quotes to pass full path as arg:Ĭ:\labJava>javac -g "c:\Documents and Settings\Dave\Desktop\labJ ava\Query. This works if i'm in the same path as the java file:Ĭ:\labJava>javac -g C:/Documents and Settings/Dave/Desktop/labJ ava/Query. I have tried a million different combinations. java name or I get the "invalid flag" message. I am using Windows and I have to navigate to the folder and type only the. So am I missing a classpath or someother argument that I need to pass to the compiler (javac)?Īnd yes. getString( 1)+ " Discnt: "+cust.getString(2)) ("Select cname, city, discnt FROM customers") ("Could not load the driver") Ĭonnection con=DriverManager.getConne ost:1521:T EST","huds on","hudso n") So what this leads me to believe, is that there is something inside the compile process that is actually causing the problem because the "Query.java" program makes reference to the JDBC.Ĭlass.forName("oracle.jdbc. Now, what doesn't make sense to me, is why this DOES work:Ĭ:\Documents and Settings\Dave>javac -g c:\labjava\myfirstjavaprog. Why does it think that the last argument is a flag and not the file name? Javac: invalid flag: c:\labjava\Query.Java However, if I am in another directory, I get an error:Ĭ:\Documents and Settings\Dave>javac -g c:\labjava\Query.Java If you have the full JDK installed, you may need to change your PATH to correct this. If I am in DOS and in the SAME directory as the source file, the compile works fine. It appears you are running jgrasp under the JRE (not JDK), or a version of Java that does not support integrated debugging. I have searched all over the web and have found people complaining of this problem, but have never found an actual solution. I am having a problem compiling and running a program that uses the JDBC.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |