Making a Jar with a command prompt program
I have a non GUI interface program (strictly command prompt) and i would like to make it automatically executable, what is the best way to do so, and how do i go about doing it?
I am using Jcreator Pro.
Ok, so to use this .bat file properly i need a .jar file that is associated with my program. As for creating the .jar, if my whole program isn't a project or anything (just one .java file) isnt the .jar just one line? (the manifest or whatever its called)
Edited by: PathogeN on Nov 26, 2008 11:23 PM
Edited by: PathogeN on Nov 26, 2008 11:29 PM
Similar Messages
-
Jar run from command prompt?
Hi !
How do I run my Jar from the command prompt window?
my jar's name is " javaproject 7"
Thanks!Java application launcher documentation:
http://java.sun.com/j2se/1.5.0/docs/tooldocs/windows/java.html -
Run class in jar file using command prompt
Hi,
I have created a jar file OSTBTLDataTransfer.jar using eclipse and tried to run a class Person in the package com.aqa.details using the command prompt like this
java -classpath com.aqa.details.Person
but this complained about a jar file dependency and i have set it to the classpath like this:
set CLASSPATH=C:\jarup\abc\ibatis-2.3.4.726.jar
but it couldn't find the dependency when i tried to run again.
please let me know your suggestions
Thanks,
KCjava -classpath OSTBTLDataTransfer.jar com.aqa.details.Person
or if you have an appropriate manifest in the jar simply
java -jar OSTBTLDataTransfer.jar -
Interfacing Java with the command prompt
Hi everyone,
I'm very new to java and wanted to see if anyone had any advice before i started getting too far into this project. I want to write a java program which allows the user to draw lines on the screen, and move them around, and then the program will compute the equations of these lines and feed them into another program to study the algebra behind the geometry.
I've written an applet which is a start towards what I want: http://math.berkeley.edu/~aboocher/Mouse2.html but I'm encountering problems since it seems very difficult to have an applet write to a file, so I started trying to just create a self-contained java program. Before I move further I was hoping someone could point me in the right direction.
Ultimately I would like a window where the user can draw some geometric objects and the computer will write the equations to a file and then when I click "compute" say, it will run my other program (which can be done from the command line) and display "true or false"
In case it matters, I'm on a Mac and the exterior program is called Macaulay 2.
Thanks for your help!That seems highly reasonable.
If your going to be writing to a file, it would probably be a better approach to create an application.
As for the arithmetic part of it, you'll want to save the points that the lines dropped, to use for future calculations. Using arrays would probably be a good idea.
You'll also want to reduce the flickering problem with your applet on the website you linked to. Maybe double buffer? Along with using arrays to recall previous lines -
Error to execute the script through command prompt
I tried to execute the script through command prompt. I got some following error. Could you please advice me how to rectify this.
cscript D:\JS\Test.js
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.
D:\JS\Test.js(1, 1) Microsoft JScript runtime error: 'app' is undefined.
Thanks,
PrabudassI haven't use CS for quite some time and file associations may not work with the command prompt.
You can try using Windows Explorer to browse to a .js file then right click on that file. From the popup menu choose Open With. Even if you see Photoshop in the file list choose Browse at the bottom. Browse to Photoshop and make sure to check 'Always use selected program...'
If that doesn't work you will need to create an action that runs your script and make a droplet from that action. You can then use the droplet in the command prompt. You may also need to create a 'dummy' image file to launch the droplet with if you script doesn't require an open document at startup. See http://www.ps-scripts.com/bb/viewtopic.php?t=967 -
Server 2012 r2 only boots to command prompt
Hello All, I have been trying to get SharePoint 2013 Foundation on a fresh server. (This is not a SharePoint question) Server 2012 R2 was working fine. However problems getting all the prerequisites installed and configured properly. When I was making
changes I was required to restart server. When I did I was able to get to the login screen. Then login seemed to work except that all I was able to get was command prompt after login. I am able to run SCONFIG. However the "restore gui" selection
is missing. Also powershell.exe will not run stating it is an unknown command. I checked through folders and those folders appear to be missing. At this point I have no idea how to much of anything. I was able to download and install updates. Ha thanks MS.
Otherwise any help is greatly appreciated.The same scenario described occurred here: ServerManager would not launch, PowerShell was missing from the expected location in the system drive, explorer.exe was missing, and msconfig.exe was missing, etc.
Interestingly enough, the server seemed intact in other ways, such as the administrative share worked (\\servername\c$), and it would reboot normally enough, but to a black screen with a command prompt.
A small syntactical correct to step 5. above should be noted: '/wimfile'... not '/winfile'
dism /get-wiminfo /wimfile:d:\sources\install.wim
Other than that, R.Derickson, the fix worked to bring back the expected graphical state.
Thank you. -
Uninstall SQL Server 2012 in Command Prompt
I need to make an uninstall script for SQL Server 2012 Express but I can't figger it out.
After I uninstalled the SQL instance with following command:
C:\Program Files\Microsoft SQL Server\110\Setup Bootstrap\SQLServer2012\setup.exe /Action=Uninstall /FEATURES=SQL,AS /INSTANCENAME=SQLEXPRESS /QUIETSIMPLE
There are still a couple of programs that I want to remove:
Microsoft SQL Server 2008 Setup Support Files
Microsoft SQL Server 2012 Transact-SQL ScriptDom
Microsoft SQL Server 2012 Native Client
SQL Server Browser for SQL Server 2012
Microsoft VSS Writer for SQL Server 2012
Microsoft - SQL Server 2012 Express
Microsoft SQL Server 2012 Setup (English)
Can someone please help me removing them without using 'Add or Remove Programs'
and preferably without any interaction.Hi Michael1105,
Are there any other instances except SQL Server Express in your system?
To completely uninstall SQL Server Express include the Browser, Writer and other SQL Server components, I recommend you use the
ConfigurationFile.ini file. Below is an example for you.
Firstly, you can perform the following steps to generate a configuration file.
1. Right click SQL Server 2012 from control panel and select Remove
2. Follow the wizard through to the Ready to Remove page. The path to the configuration file is specified in the
Ready to Remove page in the configuration file path section.
3. Cancel the setup without actually completing the uninstallation, to generate the INI file.
Secondly, you can specify the configuration file at the command prompt and uninstall SQL Server 2012 Express, or you can change the scripts in configuration file to meet your requirement, then copy the scripts
in command prompt to uninstall SQL Server 2012 Express.
Reference:
Install SQL Server 2012 Using a Configuration File
Thanks,
Lydia Zhang
Lydia Zhang
TechNet Community Support -
Scanner works in JCreator but doesn't when run from Command Prompt?
Can someone tell me why I can run this program in JCreator with no problems, but when I run it with the Command prompt it throws a java.util.InputMismatchException if I input anything?
import java.util.Scanner;
public class tester {
public static void main(String[] args) {
Scanner in = new Scanner(System.in).useDelimiter("\n");
System.out.println("Type either 1 or 2");
int temp = in.nextInt();
System.out.println("");
if (temp == 1)
System.out.println("you typed 1");
if (temp == 2)
System.out.println("you typed 2");
else
System.out.println("you typed something else!");
}Try this code it is running correctly on command prompt
import java.util.Scanner;
public class tester {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.println("Type either 1 or 2");
int temp = in.nextInt();
System.out.println("");
if (temp == 1)
System.out.println("you typed 1");
if (temp == 2)
System.out.println("you typed 2");
else
System.out.println("you typed something else!");
} -
Using java from command prompt
Hi, I have used command prompts for a long time, though not recently. But this has never happenned to me, and I may have been using a different OS the last time I really used a command prompt. I am currently running Windows XP.
Anyways, when I try to simply change a directory, you know cd "filename", it tells me:
Parameter format not correct - "filename"
Basically, it won't accept any strings as a parameter. I'm really surprised at this. Is this normal? In any case, I got around this by using the short names for files. For example, I used the name docume~1 instead of "documents and settings".
Then, when I got to the folder where my java files were stored, it told me it was an invalid directory but nonetheless allowed me to use it. However, no commands worked except for cd..
Java did not work, nor did basic commands like dir or help. Do you have any idea what is wrong with my command prompt? I know this is not specifically a question about Java, but I can't use Java without this.
thanks.Basically, it won't accept any strings as a parameter.
I got around this by using the short names for files. For example, I
used the name docume~1 instead of "documents and settings".So it is accepting some strings.
Check that you are using cmd.exe not command.com. Ie, from
Start->Run... typecmdAnd not command.
Try the javac command and if the computer says'javac' is not recognized as an internal or external command,
operable program or batch file.then will have to set your OS path (not CLASSPATH - do not set
CLASSPATH at any time or the command prompt will likely never work
again).
Instructions for setting the OS path are [urlhttp://java.sun.com/j2se/1.5.0/install-windows.html]here. Scroll down to
point number 5 -
Cant See RTF Files in JAR but can when running program from command prompt
posted August 16, 2005 08:26 AM
Hi ALL:
I have a Java Swing APP. It has Menus which displays information through File I/O in a JEditorPane.
When I run my program from Command Prompt using "java myApp" it shows these RTF Files as it is.
However when I run them after converting Directory into a Executable JAR FILE, it fails. I get a blank JEditorPane. My RTF files are in the CORRECT PATH, just dont get displayed. Rest of the APP works fine.
Chetan
any suggetsionsposted August 16, 2005 08:26 AM
Hi ALL:
I have a Java Swing APP. It has Menus which displays information through File I/O in a JEditorPane.
When I run my program from Command Prompt using "java myApp" it shows these RTF Files as it is.
However when I run them after converting Directory into a Executable JAR FILE, it fails. I get a blank JEditorPane. My RTF files are in the CORRECT PATH, just dont get displayed. Rest of the APP works fine.
Chetan
any suggetsions -
How to run a java program in command prompt
hi i want to run a java program from in command prompt from another directory
i want to run a file named First in C:\Program Files\Java\jdk1.6.0_07\bin
so when i give the command
java "C:\Program Files\Java\jdk1.6.0_07\bin\First"
it doesnt works it shows
C:\>java "C:\Program Files\Java\jdk1.6.0_07\bin\First"
Exception in thread "main" java.lang.NoClassDefFoundError: C:\Program Files\Java
\jdk1/6/0_07\bin\First
Caused by: java.lang.ClassNotFoundException: C:\Program Files\Java\jdk1.6.0_07\b
in\First
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
Could not find the main class: C:\Program Files\Java\jdk1.6.0_07\bin\First. Pro
gram will exit.but it prints
C:\>java -cp "C:\Program Files\Java\jdk1.6.0_07\bin\" First
Usage: java [-options] class [args...]
(to execute a class)
or java [-options] -jar jarfile [args...]
(to execute a jar file)
where options include:
-client to select the "client" VM
-server to select the "server" VM
-hotspot is a synonym for the "client" VM [deprecated]
The default VM is client.
-cp <class search path of directories and zip/jar files>
-classpath <class search path of directories and zip/jar files>
A ; separated list of directories, JAR archives,
and ZIP archives to search for class files.
-D<name>=<value>
set a system property
-verbose[:class|gc|jni]
enable verbose output
-version print product version and exit
-version:<value>
require the specified version to run
-showversion print product version and continue
-jre-restrict-search | -jre-no-restrict-search
include/exclude user private JREs in the version search
-? -help print this help message
-X print help on non-standard options
-ea[:<packagename>...|:<classname>]
-enableassertions[:<packagename>...|:<classname>]
enable assertions
-da[:<packagename>...|:<classname>]
-disableassertions[:<packagename>...|:<classname>]
disable assertions
-esa | -enablesystemassertions
enable system assertions
-dsa | -disablesystemassertions
disable system assertions
-agentlib:<libname>[=<options>]
load native agent library <libname>, e.g. -agentlib:hprof
see also, -agentlib:jdwp=help and -agentlib:hprof=help
-agentpath:<pathname>[=<options>]
load native agent library by full pathname
-javaagent:<jarpath>[=<options>]
load Java programming language agent, see java.lang.instrument
-splash:<imagepath>
show splash screen with specified image
C:\> -
Technician computer is Windows 7 HP x64.
Running latest version of WAIK.
Goal: To make a Winpe disc for each processor architecture (AMD64, x86, IA64) with an included Gimage.exe using this code for the default startnet.cmd file found in system32 directory of winpe boot.wim
wpeinit
if /i %PROCESSOR_ARCHITECTURE%==amd64 (
cd x64
start gimagex.exe
if /i %PROCESSOR_ARCHITECTURE%==ia64 (
cd x64
start gimagex.exe
if /i %PROCESSOR_ARCHITECTURE%==x86 (
cd x86
start gimagex.exe
These are the commands I have processed for the x86 variant:
copype x86 c:\pe\x86\
Dism /mount-wim /wimfile:C:\pe\x86\winpe.wim /index:1 /mountdir:C:\mount
**It is at this point I copy over my x86 folder, x64 folder, and overwrite the startnet.cmd file.
dism /unmount-wim /mountdir:C:\mount /commit
oscdimg -n bc:\pe\x86\etfsboot.com c:\pe\x86\iso c:\pe\x86.iso
^^It is at this command I receive this error:
ERROR: Could not delete existing file "c:\pe\x86\iso"
Error 5: Access is denied.
Please note that all commands before were hand-typed, no copy or pasting from any directory or .chm
One thread referred to some Application Management service, but I can report that there is no such service installed in my machine.
Thank You!
UPDATE:
I copied the winpe.wim file from the x86 root directory into the iso directory and renamed it to boot.wim Now, if I copy the contents to a flash drive and put it into a client
computer, it boots to the PE perfectly, script and all.
However, when trying to use the oscdimg command, I do get an .iso successfully, but when I burn it, I don't know what to do in the way of boot options, and if I keep defaults (imgburn)
it results in an un-bootable dvd.
Suggestions are greatly appreciated.Don't copy and paste instead type manually it will work.
[email protected]
OMG! Yes, you are correct ... but I have no idea why! I retyped the command line:
oscdimg -n -be:\winpe_amd64\etfsboot.com e:\winpe_amd64\ISO e:\winpe_amd64\winpe_amd64.iso
into Notepad, and then pasted it into the Command Prompt, and it worked!
Perhaps there must be some hidden characters included when pasting directly, even though I first pasted the command line into Notepad, and then into Command Prompt
(C:\Program Files\Windows AIK\Tools\PETools>).
I had to retype the command line in Notepad before copying and pasting, before it would work.
Wow, thanks!
Cheers, Navy Flyer -
How to run a program as an administrator from within a non-elevated command prompt?
I have a project that is going to be running on a kiosk, and the user that is running the kiosk software is going to be restricted. I have an alternate administrator account, but I cannot seem to figure out how to open my program running as this administrator
user. I have tried to use runas, like so:
runas /user:admin kiosk.exe
However, when I try to run this command, it asks me for the password of the administrator account and my program doesn't open correctly. It fails to open at all. If I change the run as to a start command, then the program executes fine so its
not a problem with my software.
Is there a way to pass a password parameter to runas so that it will not prompt for the password every time? If there is not, can someone think of another way for me to elevate my process to administrator without being logged in as one through the
command prompt?Hi KevinGEAR,
You want to allow the others without the administrator`s level to run this software and meanwhile the administrator is not logged in, right?
Here is an alternative solution :
1.To work with this solution, a built-in administrator account should be enabled and meanwhile you can create a standard account. The built-in administrator account is different from the administrator account you created.
To enable built-in administrator account:
Ways to Enable / Disable the Built-In Windows 7 Admin Account
http://social.technet.microsoft.com/wiki/contents/articles/3040.enable-disable-the-local-hidden-built-in-administrator-account-in-windows-7.aspx
2. Use the following code
runas /user:ComputerName\Administrator /savecred "Full path to program's exe file"
Here is a link for reference:
Elevated Program Shortcut - Create for Standard User
http://www.sevenforums.com/tutorials/193743-elevated-program-shortcut-create-standard-user.html
NOTE: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites.
Best Regards -
I'm using ProcessStartInfo.RedirectStandardOutput and Process.BeginOutputReadLine to capture the standard output of another program (specifically,
youtube-dl.exe) and save them into a string variable.
However the result variable contains only usual characters of my language such as traditional Chinese and English letters; characters such as Korean or Latin letters with accents simply vanished.
I File.WriteAllText-ed the result variable and checked the file using serveral text editors, so I'm sure they're lost, not that they exist and merely be un-display-able by console window.
Plainly executing youtube-dl in Windows Command Prompt displays complete messages including these foreign characters.
My youtubeDL_process.OutputDataReceived is simply:
(s, e) => { if(!string.IsNullOrWhiteSpace(e.Data)) this._filename = e.Data; }
How to make the redirected standard output string with foreign characters complete, just like one directly generated in a command prompt?Try a different experiment of starting your second EXE:
string exe =
@"path to your EXE with arguments . . .";
Process p =
new
Process
StartInfo =
UseShellExecute = false,
RedirectStandardOutput = true,
StandardOutputEncoding = Encoding.UTF8,
FileName = "cmd.exe",
Arguments = "/C chcp 65001 > null && " + exe
p.Start();
string output = p.StandardOutput.ReadToEnd();
p.WaitForExit();
Specify the full path in the exe variable, using quotation marks if it contains spaces.
Then check the value of output. -
Problem with executing java on command prompt
Hi my program uses java mySQL connector to connect to a local host. The program works fine when i run through netbeans. But when i run through command prompt it gives in this error message
java.lang.ClassNotFoundException:com.mysql.jdbc.Driver Can anyone help me to solve this problemadd mysql.jar file to ur classpath, it will work fine.
Maybe you are looking for
-
How to create Excel file in client system...
please tell me, how to create a excel file in the client system. in my application i am displaying the report from database. my requirement is to create that report in excel format that should be stored in client machine...
-
I have looked at various help topics but nothing is working; I have not deleted my history lately and nothing in my preferences is checked to do so automatically. I also tried deleting 'sessionstore.js' but that didn't help either. Firefox acknowledg
-
IWeb won't let me publish. Asking for mobileme password
Hello, not sure what is going on here. All of the sudden iWeb won't let me publish my site. When I go to publish a Mobileme window comes up asking me to sign in. Maybe I changed my password without remembering it. How do I get me password and Mem
-
Can't Use Video with other Mac users who use AIM
I know that ichat is compatible for video chats with other pc users who use aim, but does it work with other mac users who use aim? Everytime I try to chat with my friend, I get an error message when trying to start of a video chat. BTW, I use a iMac
-
Hi, I've checked multiple forums to find an answer for the Air extension. I use Dreamweaver (DW) CC, and I have extension manager (EM) CC as well. The problem is, if I run the EMCC from creative cloud, the air extension is non-existent there under DW