开发者

I am having problems in running my Java program

开发者 https://www.devze.com 2022-12-29 03:07 出处:网络
I\'m a beginner in Java so this question might seem a little stupid, my JDK and JRE are installed in C:\\program files. I write my program and save it in in my folder, G:\\start.

I'm a beginner in Java so this question might seem a little stupid, my JDK and JRE are installed in C:\program files. I write my program and save it in in my folder, G:\start.

Now my program compiles without any error (the .class file is also generated), but when I run my program it says "unable to lo开发者_运维问答cate G:\lib\amd64\jvm.cfg", so I copy the 'lib' folder from my JDK folder and paste it in G:. Again program compiles without any error, but when I run it, it gives me a new error saying "unable to locate G:\bin\server\jvm.dll", so I copy the 'bin' folder to g:, but now when I run, it gives me the same error again "unable to locate G:\bin\server\jvm.dll". Where am I going wrong?


Create an environment variable called JAVA_HOME and point it to the bin directory of your Java installation. Also add the same directory to your PATH variable. This should solve your problem.

PS: JAVA_HOME may not be required, but it will help if you have tomcat and stuff installed.


try to save it as a .jar, go to your cmd and use:

java -jar G:\bin\server\jvm.jar

this should work.


The best advise I can give you is to download an IDE to get started. BlueJ is an IDE aimed at getting people started using java and is used in many universities world wide.

take a look at www.bluej.org and you should be up and running in seconds.

Karl

0

精彩评论

暂无评论...
验证码 换一张
取 消