2013年12月18日星期三

Double-click the jar package can not run ah , how else

I set when exporting the main class , and I'm going crazy , do not do a good job for a night ,
cmd which can run with java-jar xxx.jar
Later google it, saying we should . jar related to "xxx \ jre \ bin \ javaw.exe" "% 1"% *, I have to get this or not
I cry
------ Solution -------------------------------- ------------ compression software

install the associated files changed. First in the compression software automatically associated in the jar removed ( if any ) .
then associate the jar changed javaw-jar "% 1" "% *"
------ Solution -------- ------------------------------------ will select the JAR file when
direct export with eclipse ; and Runnable JAR file 's
------ For reference only ------------------------------ ---------
related properties have not added ,
reported what wrong ah ! !


------ For reference only ---------------------------------- -----
added the
Could not find the main class xxx Program will exit
------ For reference only --------------- ------------------------
so to speak , jdk demo comes with the package I double-click inside the jar it is also this effect , it is certainly not jar file in question is a question set on the computer, but do not know where the problem is , and encountered the same problem and solved say what
------ For reference only ------ ---------------------------------
Manifest-Version: 1.0
Main-Class: A
Note : "Manifest-Version:" and "1.0", "Main-Class:" There must be one and only one space between "A"! To add the class to run the full package name
------ For reference only ------------------------------ ---------
system , there are several versions of jre
------ For reference only ------------------ ---------------------

MANIFEST.MF file is how to write ?
------ For reference only -------------------------------------- -

this is very crucial . .

But if all running jar package can not run on your machine . See your java environment variable configuration. .
------ For reference only -------------------------------------- -
write manifest.mf file in the directory : use Notepad to write , such as the main class is Test, then write
Main-Class: There is a space between and Test , finished to have a carriage return , save it to manifest.mf: Test,

Then enter DOS below into the current directory to play : jar cfvm 123.jar manifest.mf * class.
123 for the JAR package name , if English and numbers, can not use Chinese
This can be a
------ For reference only ------------------------------ ---------
certainly not the reason, said the demo inside the jar will not run it
And whether it is inside the command line java-jar xxx.jar or javaw-jar xxx.jar no problem
------ For reference only ----- ----------------------------------
inside on a jdk jre, public jre not installed , expect too may be the reason , then loaded up or not so he relieved
------ For reference only ---------------------- -----------------
we look at the problem , okay , if you really that simple , I would not ask the
stress again the next bar , cmd which used to run java-jar xxx.jar
jdk demo comes after the installation inside the jar can not double-click to run
help us to see exactly how the trouble going on veterans

------ For reference only ---------------------------------- -----
look at this
http://stackoverflow.com/questions / 7617807/could-not-find-the-main-class-program-will-exit
------ For reference only -------------- -------------------------
not because of that , ah, I have only one jdk jre is inside with debugging features that , no independent jre equipment, also % java_home% environment variable inside the configuration \ jdk \ jre ...
------ For reference only -------------------- -------------------
inside and I put in the registry . jar related to "xxx \ jre \ bin \ javaw.exe" "% 1 "% * of
------ For reference only ------------------------------- --------
http://stackoverflow.com/questions/5428079/could-not-find-the-main-class-when-double-clicking-jar-file
I have been tangled last night is that this is the reason , but later changed or not
------ For reference only ---------------- should be associated -----------------------

Path \ to \ javaw.exe "-jar"% 1 "% *

Do you have the middle " -jar "
------ For reference only ------------------ ---------------------
Bangding . I can not double-click to run , with a compressed package open, I do not know how to change it .
------ For reference only -------------------------------------- -
oh I did not see
also met me before

on the following conditions :
1. to see what your system is , WIN7 to change the registry, as you say plus 1%, XP generally do not change
2. file name can not be Chinese , English or if the number and location of the directory structure can not have non- English characters and numbers
3. path can not be too deep, such as the desktop , the best on the list within three years, before I could not find the reason , accidentally discovered the problem, common in XP , WIN7 sometimes so you try
------ For reference only ---------------------------------- -----
choose Folder Options , change the look in the Windows folder options to run the program jar files into javaw bin under the line
------ For reference only. - --------------------------------------
If the DEMO JAVA can be used, you can not.

Main-Class is not set .
------ For reference only -------------------------------------- -
talk about the steps it under your pack ,
------ For reference only -------------------------- -------------
win7 ah , plus a 1%
folder in my computer is in English , documents are mostly English name , even the spaces are almost no
path is f: \ java \ too deep right
------ For reference only ----------------------- ----------------
said the demo program can not double-click to run ah
------ For reference only --------- ------------------------------
command line using java-jar xxx.jar or javaw-jar ; xxx.jar environment variables to run instructions and packaging are not a problem now , is packaged eclipse export , ah, do not bother knocking command
------ For reference only ------------ ---------------------------
Bangding I was the problem, double-click the package can not run , choose open
Java (TM) Platform SE binary is not given, do not run
jar command line operation can be performed

C:\Users\hp\Desktop\复习>jar cvfm select.jar manifest.mf .
已添加清单

正在添加: manifest.mf(输入 = 22) (输出 = 24)(压缩了 -9%)
正在添加: Select_a/(输入 = 0) (输出 = 0)(存储了 0%)
正在添加: Select_a/META-INF/(输入 = 0) (输出 = 0)(存储了 0%)
正在添加: Select_a/META-INF/MANIFEST.MF(输入 = 71) (输出 = 71)(压缩了 0%)
正在添加: Select_a/Select_a.class(输入 = 6246) (输出 = 2994)(压缩了 52%)
正在添加: Select_a$1$1.class(输入 = 651) (输出 = 413)(压缩了 36%)
正在添加: Select_a$1$2.class(输入 = 796) (输出 = 510)(压缩了 35%)
正在添加: Select_a$1$3.class(输入 = 888) (输出 = 589)(压缩了 33%)
正在添加: Select_a$1$4.class(输入 = 866) (输出 = 533)(压缩了 38%)
正在添加: Select_a$1.class(输入 = 1208) (输出 = 684)(压缩了 43%)
正在添加: Select_a$InnerShow$1.class(输入 = 783) (输出 = 496)(压缩了 36%)
正在添加: Select_a$InnerShow$2.class(输入 = 783) (输出 = 495)(压缩了 36%)
正在添加: Select_a$InnerShow$3.class(输入 = 783) (输出 = 496)(压缩了 36%)
正在添加: Select_a$InnerShow.class(输入 = 685) (输出 = 395)(压缩了 42%)
正在添加: Select_a.class(输入 = 5315) (输出 = 2302)(压缩了 56%)
正在添加: Select_a.jar(输入 = 3459) (输出 = 3307)(压缩了 4%)

C:\Users\hp\Desktop\复习>java -jar select.jar

C:\Users\hp\Desktop\复习>

------ For reference only ----------------------------------- ----

this setting. . . Did not find
------ For reference only -------------------------------- -------

directory path can not have Chinese
I just packed directory is C: \ Users \ hp \ Desktop \ refresher double-click to run the command line does not run
now packaged directory to C: \ Users \ hp \ Desktop \ test double-click to run the
LZ try
------ For reference only ---------------------------- ----------- compression software
install the associated files changed. First in the compression software automatically associated in the jar to remove
then associate the jar changed javaw-jar "% 1" "% *"
------ For reference only ------ ---------------------------------

Thank you , you can use the
- ---- For reference only ---------------------------------------
you will be solved , ah, can I still not ah. .
------ For reference only -------------------------------------- -
I have encountered this problem, the command line to run the jar file , double-click on no, I do most of the day did not succeed, then I just put the folder options in the file type jar type directly deleted, then actually can double-click to run jar files
------ For reference only ------------------------------ ---------
hey , come on, I'm not going to tangle this problem. On the use of bat got
------ For reference only ---------------------------------- -----
saw this post, I know that under the right
First , windows users, Chinese default encoding is gbk, so *. jar into the Chinese directory will not be opened because the jre default is linux with the Chinese as the default encoding UTF-8, you can the jre -related settings, or do not put under Chinese directory.
Then the registry, 16th Floor, positive solutions Path \ to \ javaw.exe "-jar"% 1 "% *

------ For reference only ---------------------------------- -----
landlord , I met with you exactly the same problem, but also even inside the JDK Demo program also reported this error, run in eclipse, no problem at all . Do you have a solution yet ? Online, thank
------ For reference only ---------------------------------- -----
Chinese directories may be the problem , I just started the same way, there are Chinese directories , like
------ For reference only after rid ----- ----------------------------------
then changed the association jar "directory \% 1 ""% * "javaw"-jar "
so that you can , I am also 64 , and my situation is completely LZ like you . A long time to get things right
------ For reference only -------------------------------- -------
get it working on the next jarfix, runs just fine. http://johann.loefflmann.net/en/software/jarfix/ # Download
------ For reference only -------------------- -------------------
amount really like to make the following JVM , and the landlord of the problem, reinstall the JRE like a JDK1.7 make a
------ For reference only ------------------------------------ on ---
xp system, I also told you about the situation , java-jar xxx.jar no problem, but double-clicking dos window flashed , then no response , I put the jar package win7 system to another computer , everything is normal. I do not know the Editor .

没有评论:

发表评论