Java - How to create one Jar file instead of jar file with libraries in lib folder in Netbeans.7/11/2014 If you want to create one Jar file instead of Jar file with libraries in lib folder in Netbeans you can make it with very simple tweak. Open your build.xml file and before </project> which is the last line in the file put the code below. So the code that you have to add must be between --> and </project> lines The code: <target name="package-for-store" depends="jar"> <!-- Change the value of this property to be the name of your JAR, minus the .jar extension. It should not have spaces. <property name="store.jar.name" value="MyJarName"/> --> <property name="store.jar.name" value="YourSoftwareName"/> <!-- don't edit below this line --> <property name="store.dir" value="store"/> <property name="store.jar" value="${store.dir}/${store.jar.name}.jar"/> <echo message="Packaging ${application.title} into a single JAR at ${store.jar}"/> <delete dir="${store.dir}"/> <mkdir dir="${store.dir}"/> <jar destfile="${store.dir}/temp_final.jar" filesetmanifest="skip"> <zipgroupfileset dir="dist" includes="*.jar"/> <zipgroupfileset dir="dist/lib" includes="*.jar"/> <manifest> <attribute name="Main-Class" value="${main.class}"/> </manifest> </jar> <zip destfile="${store.jar}"> <zipfileset src="${store.dir}/temp_final.jar" excludes="META-INF/*.SF, META-INF/*.DSA, META-INF/*.RSA"/> </zip> <delete file="${store.dir}/temp_final.jar"/> </target> You have to replace YourSoftwareName with your software name.
0 Comments
To set a cursor if java you need to do this setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); WAIT_CURSOR is just an example you can set what you want.
To add an icon to your Java software that appear in the upper left and in the bottom bar add this code at the constructor of your main class Note: this is not the icon that the executable jar file will have setIconImage(Toolkit.getDefaultToolkit().getImage( getClass().getResource("/path/to/the/icon")));
Use this code to copy text to your clipboard: StringSelection stringSelection = new StringSelection (sb.toString()); Clipboard clpbrd = Toolkit.getDefaultToolkit ().getSystemClipboard (); clpbrd.setContents(stringSelection, null); Click Ctrl+I (in Netbeans) to import any missing classes if you need any If you populate dropdown box in run time to get the item text that the user selected use this code: string item = e.ClickedItem.Text
|
SamiHi, I program in C# and also in Java. I hope that i will be useful for you with these basic tips and tricks in programming ArchivesCategories |