About 359,000 results
Open links in new tab
  1. java - How do I create a file and write to it? - Stack Overflow

    May 21, 2010 · Java NIO. If you already have the content you want to write to the file (and not generated on the fly), the java.nio.file.Files addition in Java 7 as part of Java NIO provides the simplest and most efficient way to achieve your goals.

  2. java - The simplest way to create a jar file? - Stack Overflow

    Dec 16, 2024 · jar cf jar-file input-file(s) The options and arguments used in this command are: The c option indicates that you want to create a JAR file. The f option indicates that you want the output to go to a file rather than to stdout. jar-file is the name that you want the resulting JAR file to have. You can use any filename for a JAR file.

  3. How do I make a JAR from a .java file? - Stack Overflow

    Go to the directory where you have your .java files. Create a directory build. Run java compilation from the command line. javac -d ./build *.java if there are no errors, in the build directory you should have your class tree. move to the build directory and do a . jar cvf YourJar.jar * For adding manifest check jar command line switches

  4. jar - How do I create executable Java program? - Stack Overflow

    Apr 30, 2009 · jar -cvf [name of jar file] [name of directory with Java files] This will create a directory called META-INF in the jar archive. In this META-INF there is a file called MANIFEST.MF, open this file in a text editor and add the following line: Main-Class: [fully qualified name of your main class] then use this command: java -jar [name of jar file]

  5. xml - Generate Java classes from .XSD files...? - Stack Overflow

    Mar 26, 2009 · Wait a bit, and if you had a well-formed XSD file, you will get some well-formed Java classes Update: The xjc tool was part of the JDK up until JDK 8. Starting from JDK 9, the JAXB modules, including the xjc tool, were deprecated for …

  6. Java creating .jar file - Stack Overflow

    Let we have java file test.java which contains main class testa now first we compile our java file simply as javac test.java we create file manifest.txt in same directory and we write Main-Class: mainclassname . e.g : Main-Class: testa then we create jar file by this command : jar cvfm anyname.jar manifest.txt testa.class

  7. How to create a new java.io.File in memory? - Stack Overflow

    How can I create new File (from java.io) in memory, not on the hard disk? I am using the Java language. I don't want to save the file on the hard drive. I'm faced with a bad API (java.util.jar.JarFile). It's expecting File file of String filename. I have no file (only byte[] content) and can create temporary file, but it's not beautiful ...

  8. how to convert .java file to a .class file - Stack Overflow

    Dec 18, 2020 · This command (java -jar AppName.jar) does not jar it up, it executes something that has already been jarred as an executable jar file. In order to put a .class file into a jar, you would use the jar command; as in "jar -cf myjar.jar classes/*" In order to create a jar that can be executed with the java -jar command you need to specify the main ...

  9. How to generate keystore and truststore - Stack Overflow

    Nov 27, 2017 · 4.Sign the “cert-file” and cert-signed wil be the new cert: openssl x509 -req -CA ca-cert -CAkey ca-key -in cert-file -out cert-signed -days 365 -CAcreateserial -passin pass:yourpass 5.importing the ca-cert to keystore file: keytool -keystore KeyStore.jks -alias CARoot -import -file ca-cert 6.import cert-signed to keystore:

  10. java - How to make an executable JAR file? - Stack Overflow

    Mar 10, 2011 · Creating a jar file with out any dependent jars will work as per the below steps. 1.Compile Test.Java file javac Test.java --- write your code here. 2.Create a manifest file test.mf Main-Class: Test. Create the executable Jar file jar -cvmf test.mf test.jar Test.class; 4.Run the Jar file java -jar test.jar

Refresh