java cmd运行jar,从cmd运行jar

I have seen a lot of posts and found lots of data on the net about this but I am still confused.

I have downloaded a .jar file and I need to increase its heap size. I have added the jre1.6/bin in the Path of Windows 64 bit and I run from cmd.

The problem arises that it says unable to access jar file.

Can anybody explain in some detail what should I do to run it from cmd. Do i need to add the location of jar file into the Path too ?? Also I have noticed that in many posts they tell to change the classpath but I have'nt done anything as such.

Do tell if you need any extra information.

------------------------------- (Update)

This is really wierd ..... I did it what was mentioned in here and now the program loads and then exits with Out of memory error saying that it needs more heap size even though it was working before with 128 m heap size. This happens when I increase it to 1024m. Can anybosy explain why the error could have come. I have 3GB Ram so I don't understand it.....

解决方案

The following should run the jar:

java -Xmx1024m -jar /path/to/the/jar.jar

If you are running the command from the directory that the Jar is in, you can just specify it by name. Otherwise you need to qualify the path to the Jar in order for Java to be able to find it.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值