I cannot find easy solution to resolve my problem in Java. I have to run JAR file using command line with parametres.  I know how to do it like below, and it's working fine:  java -jar filename.jar argument1 argument2 etc.  For example: java -jar file.jar 50 10  But, what should I do, it I heve to use some parameters?  For example: java -jar file -width 50 -height 10  Is it possible?  [Edit] I cannot use external libraries.  Any similar answers are not so easy for beginner, some of them doesn't work for me. I'm not so stupid to open ticket first, I was looking for answer two days. But if you still think that this is duplicate just delete all posts in this topic :/.
20243
What is a good way of parsing command line arguments in Java?
69573
I'm trying to do something like   URL clientks = com.messaging.SubscriptionManager.class.getResource( "client.ks" ); String path = clientks.toURI().getPath(); System.setProperty( "javax.net.ssl.keyStore", path);   Where client.ks is a file stored in com/messaging in the jar file that I'm running.  The thing that reads the javax.net.ssl.keyStore is expecting a path to the client.ks file which is in the jar. I'd rather not extract the file and put in on the client's machine if possible. So is it possible to reference a file in a jar?  This doesn't work as getPath() returns null. Is there another way to do this?
87449
I have a python app and java app. The python app generates input for the java app and invokes it on the command line.  I'm sure there must be a more elegant solution to this; just like using JNI to invoke C code from Java.  Any pointers? (FYI I'm v. new to Python)    Clarification (at the cost of a long question: apologies) The py app (which I don't own) takes user input in the form of a number of configuration files. It then interprits these and farms work off to a number of (hidden) tools via a plugin mechanism. I'm looking to add support for the functionality provided by the legacy Java app.  So it doesn't make sense to call the python app from the java app and I can't run the py app in a jython environment (on the JVM).  Since there is no obvious mechanism for this I think the simple CL invocation is the best solution.
109794
I have a problem running .jar files by double-clicking them. When I go to the Properties dialogue I can't find Java--only Archive Manager in the list of programs. But java -jar somefile.jar opens the program.
123671
How to name the arguments in \newcommand so that when you call the macro they don't appear as {arg1}{arg2}... etc. but with the names each argument represent {caption}{label}... etc. without the use of a .cwl file.  I'm trying to implement the following \newcommand  \documentclass{article}  \usepackage{ctable} \usepackage{mwe}  \newcommand{\qfigure}[5]{\ctable[ caption= {#1},label= fig:#2,figure, pos=H,botcap, mincapwidth= #3 mm]{c} {}{\includegraphics[width=#4\textwidth]{#5}}}  \begin{document}  % \qfigure{arg1}{arg2}{arg3}{arg4}{arg5} % They would appear like this in Texstudio \qfigure{An image example}{test}{70}{0.5}{example-image-a}  \end{document}   As you can see there are five arguments where each one represents the caption, label, min width of caption (ctable parameter), width and file name respectively.  Thanks in advance for any help.
13159
I'm developing a C++ command-line application in Visual Studio and need to debug it with command-line arguments. At the moment I just run the generated EXE file with the arguments I need (like this program.exe -file.txt) , but this way I can't debug. Is there somewhere I can specify the arguments for debugging?
119201
Can a Java application be loaded in a separate process using its name, as opposed to its location, in a platform independent manner?  I know you can execute a program via ...  Process process = Runtime.getRuntime().exec( COMMAND );   ... the main issue of this method is that such calls are then platform specific.   Ideally, I'd wrap a method into something as simple as...  EXECUTE.application( CLASS_TO_BE_EXECUTED );   ... and pass in the fully qualified name of an application class as CLASS_TO_BE_EXECUTED.
38745
I have installed both OpenJDK 6 and 7. When I run "java somefile" from the command line, OpenJDK 6 is invoked. I do not want to change this default behavior. What command can I use to run my non-default OpenJDK 7 installation instead?  (I am used to running "python somefile" to invoke the default Python, "python2.7 somefile" to use Python 2.7 specifically and "python3 somefile" to use Python 3 specifically.)
90980
I installed java-8 using a PPA. After that I gave a command:  export JAVA_HOME=/usr/lib/jvm/java-8-oracle   I had heard somewhere that this command does temporary changes. But after many logouts and logins, these commands below still works (I think due to that export ... command):  java -version javac -version   But when I give the command:  export -p   It shows a list of environment variables, but in that list, does not show variable JAVA_HOME. Moreover, I wonder how the commands java and javac still works!  Can someone tell me in which file export command make changes? Are they temporary or permanent? And what else happens above? Please elaborate!
38753
I looked up several tutorials on how to install and they dont work. I do everything correctly but then i get this:     The file   '/home/mike/Downloads/minecraft.jar'   is not marked as executable.  If this   was downloaded or copied from an   untrusted source, it may be dangerous   to run.  For more details, read about   the executable bit.   I run the minecraft.jar with the Sun java runtime 6 but it doesnt work:/. Any help would be greatly appreciated!
16499
If yes, on which operating system, shell or whatever?  Consider the following java program (I'm using java just as an example, any language would be good for this question, which is more about operation systems):  public class ExitCode {     public static void main(String args[]) {         System.exit(Integer.parseInt(args[0]));     } }   Running it on Linux and bash, it returns always values less equal 255, e.g. (echo $? prints the exit code of the previous executed command)  &gt; java ExitCode 2; echo $? 2  &gt; java ExitCode 128; echo $? 128  &gt; java ExitCode 255; echo $? 255  &gt; java ExitCode 256; echo $? 0  &gt; java ExitCode 65536; echo $? 0     EDITED: the (only, so far) answer below fully  explain what happens on UNIXes. I'm still wondering about other OSes.
16794
I installed Java JDK on Ubuntu 12.04 and added Java home to my path at ~/.bashrc:  export PATH=/opt/jdk1.7.0_40/jdk1.7.0_40/bin:$PATH   This looks a little bit strange but it's really my path.  After this I installed maven through:  sudo apt-get install maven   It installed all the needed libraries and now when I run mvn -version, I see:  Error: JAVA_HOME is not defined correctly.   We cannot execute /opt/jdk1.7.0_40/bin/java   What is wrong with it?   How to solve this trouble?
79136
So I'm in Linux and I want to have a program accept arguments when you execute it from the command line.  For example,   ./myprogram 42 -b -s  So then the program would store that number 42 as an int and execute certain parts of code depending on what arguments it gets like -b or -s.
10721
Environments are allowed to have arguments, but reference to those arguments can only appear in the opening code of the environment, and not the closing code.  What is the reason for this, and are there preferred ways around it?  e.g.  \newenvironment{foo}[1]% {some code #1} % allowed {some code #1} % not allowed
8442
I have a file (called "number.txt") which I want to read to an array in Java. How exactly do I go ahead and do this? It is a straight-forward "1-dimensional" file, containing 100 numbers.  The problem is that I get an exception every time. Apparently it can't find it (I am sure its spelled correctly). When looking through code examples, it doesn't specify the file's entire file path, only the name of the file itself. How would I go about doing that if its necessary?  Also, when reading the file, will the array automatically contain all the lines of the file, or will I have to make a loop which which copies every line to corresponding subscript i?  I've heard of BufferedReader class, what it's purpose, and how does it corelate to reading input?
109620
I used   Runtime.getRuntime().exec("_____")   but it throws a IOException as below:  java.io.IOException: CreateProcess: c:/ error=5   at java.lang.Win32Process.create(Native Method)   at java.lang.Win32Process.&lt;init&gt;(Win32Process.java:63)   at java.lang.Runtime.execInternal(Native Method   I don't know whether I have the problem with specifying the path or something else. Can anyone please help me with the code.
102184
Does anyone know of a free decompiler that can decompile an entire Jar file instead of a single class? I have a problem with sub classes like name$1.class name$2.class name.class