博文

目前显示的是 九月, 2009的博文

Java jar with package

First, create a txt file called manifest.txt in the same folder as the .class file . Then type Main-Class: ExhaustiveSearch 1)note that myClass not myClass 2)note that after myClass there is a new line 3)note if this class, say ExhaustiveSearch is in a package, then the manifest.txt must be in the package folder , then type in Main-Class: exhaustive/ExhaustiveSearch Second, jar class file and manifest file with jar -cvmf manifest.txt app1.jar *.class or jar -cvmf manifest.txt app1.jar ExhaustiveSearch.class 1)note that if ExhaustiveSearch.class is in a package (not mean folder, although in the file system a package is represent as a folder), then you must jar them outside the package (because then you can jar the package together). 2) for example in path E:\java_workspace\Knapsack\bin\exhaustive\ExhaustiveSearch.class when you want to jar this, you have to create manifest.txt in folder bin. Then you type jar -cvmf manifest.txt app1.jar exhaustive/ExhaustiveSearch.clas...

Eclipse access restriction

图片
"Access restriction: Class is not accessible due to restriction on required library"; error message may be shown while developing Java projects in Eclipse IDE . Error message is self-explanatory, some classes can not be loaded into the project since restriction rules are being imposed on those classes. How to solve This error message can be removed by changing a setting inside Eclipse IDE. Open up the dialog box shown below, using any of the following paths. Windows -> Preferences -> Java -> Compiler -> Errors/Warnings (Project) Properties -> Java Compiler -> Errors/Warnings Locate the "Forbidden reference (access rules)" option under "Deprecated and restricted API" section in the dialog box. This option decides how to handle access rules defined inside Eclipse. By default it is set to "Error" which causes Eclipse to complain about references to any restricted classes. Choosing any other option (Warning or Ignore) wi...