Help Needed - Executing a .exe in a JAR
Hi,
I am stuck with a problem...
I have a jar file which has an applet class, a .exe file and a .txt file.
I want the applet to call the exe which will use the .txt and produce two more .txt files(inside the jar)..
Is it possible?
Thanks,
Bharath
I want to run my applet from the web. But the applet should call a exe (which takes in a txt as a input) and generate a couple of txt's.....
To make my applet execute the .exe i had to make it into a signed jar....so now how do i do it without putting the .exe also into the jar?
Is there any other way?
Thanks
Bharath
Similar Messages
-
Executing an file.exe from a jar file?
Does anyone know how to execute an *.exe file from jar file?
I have two files that I want to execute in one java.class, Monview.exe and Moninit.exe. Both are stored in the same jar file as the class called link.class.
This is my code to run one of the files from the hard drive
String []cmd={"c:\\monview.exe"};
try
Process pr = Runtime.getRuntime().exec(cmd);
StringBuffer buf = new StringBuffer();
InputStream istr = pr.getInputStream();
BufferedReader br = new BufferedReader(new InputStreamReader(istr));
String str;
while ((str = br.readLine()) != null) {
buf.append(str);
try {
pr.waitFor();
} catch (InterruptedException e) { }
if (pr.exitValue() != 0) {
br.close();
catch (IOException e){}
It works when i place both .exe on the local host harddrive but when I place it in the jar file nothing happens. Could anyone help me please on why does this happen and how I can fix it? Or on how to get the link.class code to extract it from the jar file and place it on the system directory and delete it from the system directory, without it knowing where the jar file comes from?Hello,
If I am not mistaken, by including the JAR file in the CLASSPATH (specifying the absolute path), or after the -classpath option after the java command (java -classpath jar_archive main_class), the system will find both files in the JAR archive.
Hope this helps! -
I need help moving my Photoshop 7 from my old laptop to my new laptop which is running Windows 7 Enterprise. I’ve tried two routes unsuccessfully. I install the CD, it does not autoplay. I execute Autoplay.exe at the root directory, I am welcomed, I choose English, I accept the EULA, I get the Install/Explore choices window, with the Install button already selected, I click the Photoshop button, the CD spins, and nothing happens. In the 2nd attempt I execute Setup.exe in the Photoshop directory, and nothing happens at all. I’m never even offered the opportunity to enter my product code. What should I do?
There could is likely a compatibility problem between the old software and the newer operating system.
-
Help needed: getting jar files to work.
Right, to start off, i have been doing php and mysql for a long time and i thought it's time to start using java.
So now im trying to create an application. I use eclipse. All works well if i run the program from eclipse. But i want to create and executable or a jar file first. I used JSmooth but with that i get an error "Could not find the main class".
While exporting the project as a jar i specified the main class in manifest specification.
So these are my classes:
the Main.class
public class Main{
public static void main(String[] args) {
PageFrame page = new PageFrame();
page.show();
}and the PageFrame.class
import java.net.*;
import java.io.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.util.*;
class PageFrame extends JFrame implements ActionListener,MouseListener{
String[] skillnames = {"attack","hitpoints","mining","strength","agility","smithing","defence","herblore","fishing","ranged","thieving","cooking",
"prayer","crafting","firemaking","magic","fletching","woodcutting","runecraft","slayer","farming","construction","hunter","summoning"};
JTextField username = new JTextField("",12);
JTextArea box = new JTextArea(10,12);
JButton search = new JButton("Search");
int[] differences = {0,83,174,276,388,512,650,801,969,1154,1358,1584,1833,2107,2411,2746,3115,3523,3973,4470,5018,5624,6291,7028,7824,
8740,9730,10824,12031,13363,14833,16456,18247,20224,22406,24815,27473,30408,33648,37224,41171,45529,50339,55649,61512,67983,
75127,83014,91721,101333,111945,122660,136594,150872,166636,184040,203254,224466,247886,273742,302288,333804,368599,407015,
449428,496254,547953,605032,668051,737627,814445,899257,992895,1096278,1210421,1336443,1475581,1629200,1798808,1986068,2192818,
2421087,2673114,2951373,3258594,3597792,3972294,4385776,4842295,5346332,5902831,6517253,7195629,7944614,8771558,9684577,10692629,
11805606,13034431,14567891};
URL page;
static String name;
JLabel[] skills = new JLabel[24];
JLabel skillicons = new JLabel();
public PageFrame(){
super("Stats Lookup");
setSize(800,600);
setResizable(false);
try{
UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
SwingUtilities.updateComponentTreeUI(this);
}catch (Exception e){
System.err.println("Yo" + e);
//teen labelid;
for (int i = 0; i < skills.length;i++){
ImageIcon icon = new ImageIcon(PageFrame.class.getResource("images/skillimages/" + skillnames[i] + ".gif"));
skills[i] = new JLabel("00",icon,JLabel.CENTER);
JPanel pane = new JPanel();
GridBagLayout maingrid = new GridBagLayout();
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
GridBagConstraints constraints = new GridBagConstraints();
JPanel skillPane = new JPanel();
GridBagLayout levelslyo = new GridBagLayout();
GridBagConstraints sConstraints = new GridBagConstraints();
sConstraints.ipadx = 15;
sConstraints.ipady = 10;
skillPane.setLayout(levelslyo);
int k = 0;
int m = 1;
buildconstraints(sConstraints,12,4,1,1,2,2);
skillPane.add(skillicons);
for (int i = 0; i < skills.length;i++){
buildconstraints(sConstraints,m,k,1,1,2,2);
levelslyo.setConstraints(skills, sConstraints);
//skills[i].setText(" 0 ");
skillPane.add(skills[i]);
skills[i].addMouseListener(this);
m+=2;
if (m == 7){
m = 1;
k +=1;
/*m = 0;
k = 0;
for (int i = 0; i < skills.length;i++){
System.out.println("Paremale: " + m + " Alla: " + k);
buildconstraints(sConstraints,m,k,1,1,2,2);
levelslyo.setConstraints(skillicons, sConstraints);
skillicons = new JLabel(icon);
skillPane.add(skillicons);
m+=2;
if (m == 6){
m = 0;
k +=1;
buildconstraints(constraints,0,0,1,1,100,100);
maingrid.setConstraints(username, constraints);
buildconstraints(constraints,1,0,1,1,100,100);
maingrid.setConstraints(search, constraints);
buildconstraints(constraints,0,1,1,1,100,100);
maingrid.setConstraints(skillPane, constraints);
pane.setLayout(maingrid);
constraints.fill = GridBagConstraints.BOTH;
search.addActionListener(this);
box.setEditable(false);
buildconstraints(constraints,1,1,2,1,120,100);
maingrid.setConstraints(box, constraints);
pane.add(username);
pane.add(search);
pane.add(box);
pane.add(skillPane);
setContentPane(pane);
//getContentPane().add(scroll);
pack();
setVisible(true);
WindowListener l = new WindowAdapter(){
public void windowClosing(WindowEvent evt){
System.exit(0);
addWindowListener(l);
void buildconstraints(GridBagConstraints gbc, int gx, int gy, int gw, int gh, int wx,int wy){
gbc.gridx = gx;
gbc.gridy = gy;
gbc.gridwidth = gw;
gbc.gridheight = gh;
gbc.weightx = wx;
gbc.weighty = wy;
/*Vector ranks = new Vector();
Vector levels = new Vector();
Vector exp = new Vector();*/
class Stats{
int[] levels = new int[34];
int[] experience = new int[34];
int[] ranks = new int[34];
Stats stats = new Stats();
public void getStats(URL url){
URLConnection conn = null;
InputStreamReader in;
BufferedReader data;
String line;
StringBuffer buf = new StringBuffer();
try{
conn = this.page.openConnection();
conn.connect();
//box.setText("Connection opened");
in = new InputStreamReader(conn.getInputStream());
data = new BufferedReader(in);
//box.setText("Reading data...");
int ts=0;
while ((line = data.readLine()) != null){
buf.append(line + "\n");
StringTokenizer tokenize;
tokenize = new StringTokenizer(line.toString(),",");
int[][] paarid = {{1,0},{2,3},{3,6},{4,1},{5,9},{6,12},{7,15},{8,11},{9,17},{10,16},{11,8},{12,14},{13,13},
{14,5},{15,2},{16,7},{17,4},{17,10},{19,19},{20,20},{21,18},{22,22},{23,21},{24,23}};
if (ts < 25 && ts > 0){
int slot = paarid[ts-1][1];
stats.ranks[slot] = Integer.parseInt(tokenize.nextToken());
int yo = Integer.parseInt(tokenize.nextToken());
stats.levels[slot] =yo;
stats.experience[slot] = Integer.parseInt(tokenize.nextToken());
ts++;
for (int i = 0; i < skills.length;i++){
String text = ""+stats.levels[i];//testings[i];//
skills[i].setText(text);
}catch(IOException e){
box.setText("Insert a username \nfirst!");
public String getNextXp(int level, int currxp){
String nextXp;
if (level > 98){
nextXp = "N/A";
}else{
nextXp = ""+(differences[level] - currxp);
return nextXp;
public void actionPerformed(ActionEvent evt){
String newuser = username.getText().toString();
name = newuser;
String address = "http://hiscore.runescape.com/index_lite.ws?player="+name;
try{
page = new URL(address);
getStats(page);
}catch(MalformedURLException e){
box.setText("Insert a username");
repaint();
public void mouseEntered(MouseEvent e) {
//if (experience[].isEmpty()){
Object s = e.getSource();
for (int i = 0; i < skills.length;i++){
if (s == skills[i]){
box.setText("Rank: " + stats.ranks[i] + "\nExperience: " + stats.experience[i] + "\nExp until next: " + getNextXp(stats.levels[i],stats.experience[i]));
public void mouseExited(MouseEvent e) {
box.setText("");
public void mouseClicked(MouseEvent e) {
public void mousePressed(MouseEvent e) {
public void mouseReleased(MouseEvent e) {
This is just a little project i thought i'd make for learning.
But can anyone help me make a working jar or an exe file?
The Jar i created does nothing, no error or anything.
Thanks for Help.How should i run the jar file then? I am double clicking it yes.
EDIT: i ran the program through command line and i got an error:
Exception in thread "main" java.lang.NullPointerException
at javax.swing.ImageIcon.<init>(Unknown Source)
at PageFrame.<init>(PageFrame.java:41)
at Main.main(Main.java:4)OK - so it looks like you've found a command line!
You read these stack traces from the top down. Often the most interesting line is the first line that refers to your code. In this case line 41 of PageFrame.java which, I guess is this:
ImageIcon icon = new ImageIcon(PageFrame.class.getResource(
"images/skillimages/" + skillnames[i] + ".gif"));The ImageIcon constructor is grumbling about being told to construct an icon from a null resource. getResource() will return null if it cannot find the resource that you specify.
The first thing to do is check that the .gif image is where it should be. You have specified it as "images/skillimages/etc" so use the command line to view the contents of the .jar file (or maybe Eclipse will let you do this). Next to PageFrame.class there should be a folder "images" and within it a folder "skillimages" and within that the image file. If not then your jar export has been seen up wrongly and is not including the required resource files.
(The "View" command is explained here: [http://java.sun.com/docs/books/tutorial/deployment/jar/view.html].)
Next check the case of the file names. On Windows getResource() will not worry about the cAsE of filenames so the resources will be located fine when running the program unjarred (including within Eclipse). But it does worry about the case of jar entry names. Bottom line: keep the file names all lower case because you use them that way in the code.
Finally, in case it is a particular image resource that's causing the problem you could add some code to print out its name just before you try and create the icon.
for (int i = 0; i < skills.length;i++){
System.out.println(
"About to make icon from " + "images/skillimages/" + skillnames[i] + ".gif");
ImageIcon icon = new ImageIcon(PageFrame.class.getResource(
"images/skillimages/" + skillnames[i] + ".gif"));
skills[i] = new JLabel("00",icon,JLabel.CENTER);
} -
Help needed to loadjava apache poi jars into oracle database.
Help needed to loadjava apache poi jars into oracle database. Many classes left unresolved. (Poi 3.7, database 11.1.0.7). Please share your experience!
Hi,
The first 3 steps are just perfect.
But with
loadjava.bat -user=user/pw@connstr -force -resolve geronimo-stax-api_1.0_spec-1.0.jar
the results are rather unexpected. Here is a part of the log file:
arguments: '-user' 'ccc/***@bisera7-db.dev.srv' '-fileout' 'c:\temp\load4.log' '-force' '-resolve' '-jarsasdbobjects' '-v' 'geronimo-stax-api_1.0_spec-1.0.jar'
The following operations failed
resource META-INF/MANIFEST.MF: creation (createFailed)
class javax/xml/stream/EventFilter: resolution
class javax/xml/stream/events/Attribute: resolution
class javax/xml/stream/events/Characters: resolution
class javax/xml/stream/events/Comment: resolution
class javax/xml/stream/events/DTD: resolution
class javax/xml/stream/events/EndDocument: resolution
class javax/xml/stream/events/EndElement: resolution
class javax/xml/stream/events/EntityDeclaration: resolution
class javax/xml/stream/events/EntityReference: resolution
class javax/xml/stream/events/Namespace: resolution
class javax/xml/stream/events/NotationDeclaration: resolution
class javax/xml/stream/events/ProcessingInstruction: resolution
class javax/xml/stream/events/StartDocument: resolution
class javax/xml/stream/events/StartElement: resolution
class javax/xml/stream/events/XMLEvent: resolution
class javax/xml/stream/StreamFilter: resolution
class javax/xml/stream/util/EventReaderDelegate: resolution
class javax/xml/stream/util/StreamReaderDelegate: resolution
class javax/xml/stream/util/XMLEventAllocator: resolution
class javax/xml/stream/util/XMLEventConsumer: resolution
class javax/xml/stream/XMLEventFactory: resolution
class javax/xml/stream/XMLEventReader: resolution
class javax/xml/stream/XMLEventWriter: resolution
class javax/xml/stream/XMLInputFactory: resolution
class javax/xml/stream/XMLOutputFactory: resolution
class javax/xml/stream/XMLStreamReader: resolution
resource META-INF/LICENSE.txt: creation (createFailed)
resource META-INF/NOTICE.txt: creation (createFailed)
It seems to me that the root of the problem is the error:
ORA-29521: referenced name javax/xml/namespace/QName could not be found
This class exists in the SYS schema though and is valid. If SYS should be included as a resolver? How to solve this problem? -
Need urgent help. Execution of .exe files by calling from java program
This program can execute small .exe files which donot take inputs. But does not work for exe files that take input and just hangs. What could be the problem. If anyone helps me I would be very grateful.
Server code :-
import java.io.*;
import java.net.*;
public class Server1 {
private Player[] players;
private ServerSocket server;
private ExecHelper exh;
String command = null;
String message = null;
public Server1() {
players = new Player[5];
try {
server = new ServerSocket( 12345, 5 );
System.out.println("Server started...");
System.out.println("Waiting for request...");
catch( IOException ioe ) {
ioe.printStackTrace();
System.exit( 1 );
} //end Server constructor
public void execute() {
for( int i = 0; i < players.length; i++ )
try {
players[i] = new Player( server.accept() );
players.start();
catch( IOException ioe ) {
ioe.printStackTrace();
System.exit( 1 );
public static void main( String args[] ) {
Server1 ser = new Server1();
ser.execute();
System.exit( 1 );
private class Player extends Thread {
private Socket connection;
private ObjectOutputStream output;
private ObjectInputStream input;
public Player( Socket socket ) {
connection = socket;
try {
input = new ObjectInputStream( connection.getInputStream());
output = new ObjectOutputStream( connection.getOutputStream());
output.flush();
catch( IOException ioe ) {
ioe.printStackTrace();
System.exit( 1 );
public void run() {
try {
message = "Enter a command:";
output.writeObject( message );
output.flush();
do {
command = ( String ) input.readObject();
String osName = System.getProperty( "os.name" );
String[] cmd = new String[3];
if( osName.equals( "Windows 2000" )) {
cmd[0] = "cmd.exe";
cmd[1] = "/c";
cmd[2] = command;
else if( osName.equals( "Windows NT" ) ) {
cmd[0] = "cmd.exe" ;
cmd[1] = "/C" ;
cmd[2] = command ;
Runtime rt = Runtime.getRuntime();
Process proc = rt.exec( cmd );
exh = new ExecHelper( proc, output, input);
} while( !command.equals( "TERMINATE" ) );
catch( Throwable t ) {
t.printStackTrace();
} //end class Player
public class ExecHelper implements Runnable {
private Process process;
private InputStream pErrorStream;
private InputStream pInputStream;
private OutputStream pOutputStream;
private InputStreamReader isr;
private InputStreamReader esr;
private PrintWriter outputWriter;
private ObjectOutputStream out;
private ObjectInputStream in;
private BufferedReader inBuffer;
private BufferedReader errBuffer;
private Thread processThread;
private Thread inReadThread;
private Thread errReadThread;
private Thread outWriteThread;
public ExecHelper( Process p, ObjectOutputStream output, ObjectInputStream input ) {
process = p;
pErrorStream = process.getErrorStream();
pInputStream = process.getInputStream();
pOutputStream = process.getOutputStream();
outputWriter = new PrintWriter( pOutputStream, true );
in = input;
out = output;
processThread = new Thread( this );
inReadThread = new Thread( this );
errReadThread = new Thread( this );
outWriteThread = new Thread( this );
processThread.start();
inReadThread.start();
errReadThread.start();
outWriteThread.start();
public void processEnded( int exitValue ) {
try {
Thread.sleep( 1000 );
catch( InterruptedException ie ) {
ie.printStackTrace();
public void processNewInput( String input ) {
try {
out.writeObject( "\n" + input );
out.flush();
catch( IOException ioe ) {
ioe.printStackTrace();
public void processNewError( String error ) {
try {
out.writeObject( "\n" + error );
out.flush();
catch( IOException ioe ) {
ioe.printStackTrace();
public void println( String output ) {
outputWriter.println( output + "\n" );
public void run() {
if( processThread == Thread.currentThread()) {
try {
processEnded( process.waitFor());
catch( InterruptedException ie ) {
ie.printStackTrace();
else if( inReadThread == Thread.currentThread() ) {
try {
isr = new InputStreamReader( pInputStream );
inBuffer = new BufferedReader( isr );
String line = null;
while(( line = inBuffer.readLine()) != null ) {
processNewInput( line );
catch( IOException ioe ) {
ioe.printStackTrace();
else if( outWriteThread == Thread.currentThread() ) {
try {
String nline = null;
nline = ( String ) in.readObject();
println( nline );
catch( ClassNotFoundException cnfe ) {
// cnfe.printStackTrace();
catch( IOException ioe ) {
ioe.printStackTrace();
else if( errReadThread == Thread.currentThread() ) {
try {
esr = new InputStreamReader( pErrorStream );
errBuffer = new BufferedReader( esr );
String nline = null;
while(( nline = errBuffer.readLine()) != null ) {
processNewError( nline );
catch( IOException ioe ) {
ioe.printStackTrace();
Client code :-
// client.java
import java.io.*;
import java.net.*;
public class Client {
private ObjectOutputStream output;
private ObjectInputStream input;
private String chatServer;
private String message = "";
private Socket client;
public Client( String host ) {
chatServer = host;
private void runClient() {
try {
connectToServer();
getStreams();
processConnection();
catch( EOFException eofe ) {
System.err.println( "Client terminated connection ");
catch( IOException ioe ) {
ioe.printStackTrace();
finally {
closeConnection();
} //end method runClient
private void connectToServer() throws IOException {
System.out.println( "Attempting connection...\n");
client = new Socket( InetAddress.getByName( chatServer ), 12345);
System.out.println( "Connected to : "+ client.getInetAddress().getHostName());
private void getStreams() throws IOException {
output = new ObjectOutputStream( client.getOutputStream());
output.flush();
input = new ObjectInputStream( client.getInputStream());
private void processConnection() throws IOException {
while( true ){
try {
message = ( String ) input.readObject();
System.out.print( message );
InputStreamReader isr = new InputStreamReader( System.in);
BufferedReader br = new BufferedReader( isr );
String line = null ;
line = br.readLine();
output.writeObject(line);
output.flush();
catch( ClassNotFoundException cnfe) {
System.out.println( "\nUnknown object type received");
} //end processConnection
private void closeConnection() {
System.out.println( "\nClosing connection");
try {
output.close();
input.close();
client.close();
catch( IOException ioe ) {
ioe.printStackTrace();
public static void main( String args[] ) {
Client c;
if( args.length == 0 )
c = new Client( "127.0.0.1" );
else
c = new Client( args[0] );
c.runClient();pay close attention to the comments in this thread
http://forum.java.sun.com/thread.jspa?threadID=769142&messageID=4383764#4383764 -
Need urgent help. Calling of exe files from java program
This program can execute small .exe files that donot take inputs but doesn't work for exe files that takes input. what could be the problem.
Server code :-
import java.io.*;
import java.net.*;
public class Server1 {
private Player[] players;
private ServerSocket server;
private ExecHelper exh;
String command = null;
String message = null;
public Server1() {
players = new Player[5];
try {
server = new ServerSocket( 12345, 5 );
System.out.println("Server started...");
System.out.println("Waiting for request...");
catch( IOException ioe ) {
ioe.printStackTrace();
System.exit( 1 );
} //end Server constructor
public void execute() {
for( int i = 0; i < players.length; i++ )
try {
players[i] = new Player( server.accept() );
players.start();
catch( IOException ioe ) {
ioe.printStackTrace();
System.exit( 1 );
public static void main( String args[] ) {
Server1 ser = new Server1();
ser.execute();
System.exit( 1 );
private class Player extends Thread {
private Socket connection;
private ObjectOutputStream output;
private ObjectInputStream input;
public Player( Socket socket ) {
connection = socket;
try {
input = new ObjectInputStream( connection.getInputStream());
output = new ObjectOutputStream( connection.getOutputStream());
output.flush();
catch( IOException ioe ) {
ioe.printStackTrace();
System.exit( 1 );
public void run() {
try {
message = "Enter a command:";
output.writeObject( message );
output.flush();
do {
command = ( String ) input.readObject();
String osName = System.getProperty( "os.name" );
String[] cmd = new String[3];
if( osName.equals( "Windows 2000" )) {
cmd[0] = "cmd.exe";
cmd[1] = "/c";
cmd[2] = command;
else if( osName.equals( "Windows NT" ) ) {
cmd[0] = "cmd.exe" ;
cmd[1] = "/C" ;
cmd[2] = command ;
Runtime rt = Runtime.getRuntime();
Process proc = rt.exec( cmd );
exh = new ExecHelper( proc, output, input);
} while( !command.equals( "TERMINATE" ) );
catch( Throwable t ) {
t.printStackTrace();
} //end class Player
public class ExecHelper implements Runnable {
private Process process;
private InputStream pErrorStream;
private InputStream pInputStream;
private OutputStream pOutputStream;
private InputStreamReader isr;
private InputStreamReader esr;
private PrintWriter outputWriter;
private ObjectOutputStream out;
private ObjectInputStream in;
private BufferedReader inBuffer;
private BufferedReader errBuffer;
private Thread processThread;
private Thread inReadThread;
private Thread errReadThread;
private Thread outWriteThread;
public ExecHelper( Process p, ObjectOutputStream output, ObjectInputStream input ) {
process = p;
pErrorStream = process.getErrorStream();
pInputStream = process.getInputStream();
pOutputStream = process.getOutputStream();
outputWriter = new PrintWriter( pOutputStream, true );
in = input;
out = output;
processThread = new Thread( this );
inReadThread = new Thread( this );
errReadThread = new Thread( this );
outWriteThread = new Thread( this );
processThread.start();
inReadThread.start();
errReadThread.start();
outWriteThread.start();
public void processEnded( int exitValue ) {
try {
Thread.sleep( 1000 );
catch( InterruptedException ie ) {
ie.printStackTrace();
public void processNewInput( String input ) {
try {
out.writeObject( "\n" + input );
out.flush();
catch( IOException ioe ) {
ioe.printStackTrace();
public void processNewError( String error ) {
try {
out.writeObject( "\n" + error );
out.flush();
catch( IOException ioe ) {
ioe.printStackTrace();
public void println( String output ) {
outputWriter.println( output + "\n" );
public void run() {
if( processThread == Thread.currentThread()) {
try {
processEnded( process.waitFor());
catch( InterruptedException ie ) {
ie.printStackTrace();
else if( inReadThread == Thread.currentThread() ) {
try {
isr = new InputStreamReader( pInputStream );
inBuffer = new BufferedReader( isr );
String line = null;
while(( line = inBuffer.readLine()) != null ) {
processNewInput( line );
catch( IOException ioe ) {
ioe.printStackTrace();
else if( outWriteThread == Thread.currentThread() ) {
try {
String nline = null;
nline = ( String ) in.readObject();
println( nline );
catch( ClassNotFoundException cnfe ) {
// cnfe.printStackTrace();
catch( IOException ioe ) {
ioe.printStackTrace();
else if( errReadThread == Thread.currentThread() ) {
try {
esr = new InputStreamReader( pErrorStream );
errBuffer = new BufferedReader( esr );
String nline = null;
while(( nline = errBuffer.readLine()) != null ) {
processNewError( nline );
catch( IOException ioe ) {
ioe.printStackTrace();
Client code :-
// client.java
import java.io.*;
import java.net.*;
public class Client {
private ObjectOutputStream output;
private ObjectInputStream input;
private String chatServer;
private String message = "";
private Socket client;
public Client( String host ) {
chatServer = host;
private void runClient() {
try {
connectToServer();
getStreams();
processConnection();
catch( EOFException eofe ) {
System.err.println( "Client terminated connection ");
catch( IOException ioe ) {
ioe.printStackTrace();
finally {
closeConnection();
} //end method runClient
private void connectToServer() throws IOException {
System.out.println( "Attempting connection...\n");
client = new Socket( InetAddress.getByName( chatServer ), 12345);
System.out.println( "Connected to : "+ client.getInetAddress().getHostName());
private void getStreams() throws IOException {
output = new ObjectOutputStream( client.getOutputStream());
output.flush();
input = new ObjectInputStream( client.getInputStream());
private void processConnection() throws IOException {
while( true ){
try {
message = ( String ) input.readObject();
System.out.print( message );
InputStreamReader isr = new InputStreamReader( System.in);
BufferedReader br = new BufferedReader( isr );
String line = null ;
line = br.readLine();
output.writeObject(line);
output.flush();
catch( ClassNotFoundException cnfe) {
System.out.println( "\nUnknown object type received");
} //end processConnection
private void closeConnection() {
System.out.println( "\nClosing connection");
try {
output.close();
input.close();
client.close();
catch( IOException ioe ) {
ioe.printStackTrace();
public static void main( String args[] ) {
Client c;
if( args.length == 0 )
c = new Client( "127.0.0.1" );
else
c = new Client( args[0] );
c.runClient();maybe you should
1. Use code tags so the posted code is understandable
2. Stop marking your post urgent, that just puts peoples backs up
3. Stop posting the question every couple of hours on every imaginable forum.. Post it once and start a single dialog -
Executing Windows EXE program through JNLP
Hello,
I am trying to execute Windows .exe and dlls through Java web start/JNLP but unable to implement successfully. I tried by creating the content (exe and dlls) as a jar file and added as native resource library in the JNLP but not sure how to call the exe program?
Any help or sample code is much appreciated.
Thanks,
Edited by: b_raja on Feb 21, 2008 2:58 PMI am trying achieve similar thing using JNLP. So far in my research, I think you need to use the installer-desc and have an implementation in ExtensionInstallerService.
Refer to the JNLP specifications. I havent tried to implement that yet, but will update here if I get anywhere.
Cheers -
Through Java code I want to execute a exe file which is in aJar file
I am having some classes and an exe file in a directory. I have made them in to a Jar file. In a class file which is in that jar file i want to execute a Exe file which is also resides in that jar file. Is it possible to exexute that EXE file?
For Example....
1. Im having a directory named CLIENT.
2. In that directory I have 10 clss files and an EXE file.
3. These class files and EXE files are ziped in to a Jar file.
4. I have to give the Jar file to my client.
5. He can put that Jar file where ever he installed my product may be C driver or D drive like that
Now the problem is...
I want to execute the Exe File from one of the class where both the exe file and class file resides in the Jar file
This is my requirment
Can anyone Help to me to solve this problem?
Thanks in Advancd
Ibram Shah.A.M
([email protected])The answer is to extract the EXE into a temp directory, execute it, and delete it when you're done. For example:
//This is the path *inside* the JAR file!
InputStream in = getClass().getResourceAsStream("/resources/myprog.exe");
OutputStream out = new FileOutputStream("myprog.exe");
File file = new File("myprog.exe");
int data;
while((data = in.read()) >= 0) out.write(data);
in.close();
out.close();
//Execute the EXE here using java.lang.Runtime.exec()
if(file.exists()) file.delete();
... -
How to execute SAPgui.exe from java code
Hi All,
Can any one provide me the exe file name of SAP GUI related.
I need to call the SAP GUI related exe file from java.
i tried with a small java prog which executes the exe files.
it works fine with notepad.exe,javac.exe . But i am unable to execute the SAPgui.exe.
This is my java code
try{
Runtime rt=Runtime.getRuntime();
//String str= "C:
WINNT
system32
notepad.exe";
//Process pp=rt.exec("C:
j2sdk1.4.2_08
bin
javac");
Process pp=rt.exec("C:
Program Files
SAP
FrontEnd
SAPgui
SAPgui.exe");
BufferedReader br=new BufferedReader(new InputStreamReader(pp.getErrorStream()));
String line;
while ((line = br.readLine()) != null) {
System.out.println(line);
}catch(Exception e){
System.out.println(e);
and may i pass any additional parameters inorder to invoke this exe.
Please share your ideas abt this problem.
Its Urgent PLZ
Adv Thanks
Regds
Phani.hi Rajesh,
here my complete code:
try{
Runtime rt=Runtime.getRuntime();
// String str= "C:\Programmi\SAP\FrontEnd\SAPgui\saplogon.exe";
String str= "C:\Programmi\SAP\FrontEnd\SAPgui\Sapgui.exe 10.113.10.201 00";
// Process pp=rt.exec("C:\j2sdk1.4.2_08\bin\javac");
Process pp=rt.exec(str);
BufferedReader br=new BufferedReader(new InputStreamReader(pp.getErrorStream()));
String line;
while ((line = br.readLine()) != null) {
System.out.println(line);
}catch(Exception e){
System.out.println(e);
Please note that system number is only two digit and in your case is 00.
Another important think, i'm using the italian version of windows, so the program directory is c:\programmi, please change into c:\program files, or you can modify your code to be language indipendend using an system environment variable (if exist).
Hope this help
Francesco -
How to execute external exe in SSIS Package
Hi,
I wanted to know how to execute external exe from SSIS Package can any one explain me or provide me valuable links.
Regards ,
AjayThere are few things you need to take care before executing exe from SSIS
1. The arguments etc expected by exe should be clearly defined inside execute process task
2. The Path where exe exists should be accessible to the account executing the package. SO you should grant account required permissions
3. If executing from a job make sure you either define a proxy account with required permissions and configure it to run the job or give service account all access required for executing exe
see
http://www.mssqltips.com/sqlservertip/2163/running-a-ssis-package-from-sql-server-agent-using-a-proxy-account/
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
My Wiki User Page
My MSDN Page
My Personal Blog
My Facebook Page -
Execute Lotus.exe from SAP Portal
Hi All,
I need execute the Lotus.exe from KM into SAP Portal , and need open the Lotus Application in the other windows..
Please , help me..Hi Roberto,
I hope following link will be useful to you,
<b>http://help.sap.com/saphelp_nw04/helpdata/en/28/b7341c0f3e7a4494227dfaa130e520/frameset.htm</b>
Regards,
Vivek
[Pls reward points if useful] -
Hey, I hava a rather large problem. just so you know, I am american, and run english language everything. my specs are: [Windows XP PRO] [Athlon 64 FX-55] [ASUS A8N-SLI N-force 4 SLI mobo] [2 gigs ram] [2 6800GT s56 MB]. If anyone remembers, a day or two ago I posted a thread called "Driver uninstall/install help needed", that you can find here, http://forums.creative.com/creativelabs/board/message?board.id=soundblaster&message.id=28565
A guy linked me some drivers, and now, when I uninstalled the old ones and was gonna install the new ones, I clinked on the amd64 thing in the suprrt thing, went to ctzapxx, amd it says "C:/Documents and Settings/chief/desktop/drivers/support/amd64/ctzapxx.exe is not a valid win32 application."
I am now stuck with no sound or drivers unless I use the system restore point I made before I did the uninstall/install thing.
I would really like some advice, or better yet, and explanation of why they don't work and where i can get some that do. I will bump this if it falls off the 'st page until i get a answer.
Thanks so much for any help
EDIT: I'm gonna go to sleep, so I'll check on the thread in anbout 8 - 9 hours when I wake up before I go to school.Message Edited by Hillbilly_37 on 09-08-2005 06:04 AMHillbilly_37 wrote:
Hey, I hava a rather large problem. just so you know, I am american, and run english language everything. my specs are: [Windows XP PRO] [Athlon 64 FX-55] [ASUS A8N-SLI N-force 4 SLI mobo] [2 gigs ram] [2 6800GT s56 MB]. If anyone remembers, a day or two ago I posted a thread called "Driver uninstall/install help needed", that you can find here, http://forums.creative.com/creativelabs/board/message?board.id=soundblaster&message.id=28565
A guy linked me some drivers, and now, when I uninstalled the old ones and was gonna install the new ones, I clinked on the amd64 thing in the suprrt thing, went to ctzapxx, amd it says "C:/Documents and Settings/chief/desktop/drivers/support/amd64/ctzapxx.exe is not a valid win32 application."
I am now stuck with no sound or drivers unless I use the system restore point I made before I did the uninstall/install thing.
I would really like some advice, or better yet, and explanation of why they don't work and where i can get some that do. I will bump this if it falls off the 'st page until i get a answer.
Thanks so much for any help
EDIT: I'm gonna go to sleep, so I'll check on the thread in anbout 8 - 9 hours when I wake up before I go to school.Message Edited by Hillbilly_37 on 09-08-2005 06:04 AM
You're trying to run CTZAPXX.EXE version intented to be executed on 64-bit operating system (eg. Windows x64) while you're using 32-bit XP.
You find the 32-bit version of CTZAPXX lying in another folder (i386).
NOTE: When you install/update drivers using CTZAPXX.EXE you do not need to uninstall your previous drivers, but just 'accept' the 'option' asking your permission to stop all shared components while updating.
Hope this cleared something.
.jtp -
Help needed on CD740 ???
Help needed on CD740 ? My CD740 is GREAT , well , it was great !!? The sound and general performance are wonderful , but , it now has a fault !!? Shock Horror !!
What can it be ?!!? Well , the display illumination has failed , as in , there isn't any !!? Have to use a torch to read it !!? Not good. Now , here's the thing , I want a phone number (UK zone) ?to talk to an actual human and I cannot find one !!? That is soooooo annoying !!? The unit is out of warranty so I want to repair this myself , no worries , I once worked for Philips in their pro studio equipment repair workshop so I know my way around black boxes !! I would like a service manual though so that I can get the case apart without damage. So , can anyone help me with a phone number , pretty please ?!!
Thanx.I tried compling servlet, but it is raising error
that coul not find package javax.servletWhat I did not mention... you need to add those JARs in the Classpath explicitly. You will find them in %TOMCAT_HOME%\common\lib. You atleast need to add servlet-api.jar to your Classpath. :) -
Help needed : Extension manager cs6 not listing products
Help needed to Adobe extension manager cs6 to show all my cs6 products
I downloaded Extension manager from here Adobe - Exchange : Download the Adobe Extension Manager
My Computer windows xp 32bit
My Photosop version cs6
My Dreamweaver version cs6
I installed photoshop here : C:\Program Files\Adobe\Adobe Dreamweaver CS6
and my XManConfigfile
<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
<VariableForExMan>
<Data key="$sharedextensionfolder">$shareddatafolder/Adobe/Dreamweaver CS6/$LOCALE/Configuration/Extensions</Data>
<Data key="$dreamweaver">$installfolder</Data>
<Data key="$dreamweaver/Configuration">$userdatafolder/Adobe/Dreamweaver CS6/$LOCALE/Configuration</Data>
<Data key="$UserBinfolder">$userdatafolder/Adobe/Dreamweaver CS6/$LOCALE</Data>
<Data key="NeedOperationNotification">true</Data>
<Data key="QuitScript">dw.quitApplication()</Data>
<Data key="SupportedInSuite">CS6</Data>
<Data key="HostNameForCSXS">DRWV</Data>
<Data key="ProductVersion">12.0</Data>
<Data key="Bit">32</Data>
<Data key="DefaultLocale">en_US</Data>
</VariableForExMan>
</Configuration>
Extension manager installed here : C:\Program Files\Adobe\Adobe Extension Manager CS6
Photoshop Installed here: C:\Program Files\Adobe\Adobe Photoshop CS6
and my XManConfigfile
<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
<VariableForExMan>
<Data key="EmStorePath">$SharedRibsDataFolder/Adobe/Extension Manager</Data>
<Data key="$photoshopappfolder">$installfolder</Data>
<Data key="$pluginsfolder">$photoshopappfolder/Plug-Ins</Data>
<Data key="$presetsfolder">$photoshopappfolder/Presets</Data>
<Data key="$platform">Win</Data>
<Data key="$actions">$presetsfolder/Actions</Data>
<Data key="$blackandwhite">$presetsfolder/Black and White</Data>
<Data key="$brushes">$presetsfolder/Brushes</Data>
<Data key="$channelmixer">$presetsfolder/Channel Mixer</Data>
<Data key="$colorbooks">$presetsfolder/Color Books</Data>
<Data key="$colorrange">$presetsfolder/Color Range</Data>
<Data key="$colorswatches">$presetsfolder/Color Swatches</Data>
<Data key="$contours">$presetsfolder/Contours</Data>
<Data key="$curves">$presetsfolder/Curves</Data>
<Data key="$customshapes">$presetsfolder/Custom Shapes</Data>
<Data key="$duotones">$presetsfolder/Duotones</Data>
<Data key="$exposure">$presetsfolder/Exposure</Data>
<Data key="$gradients">$presetsfolder/Gradients</Data>
<Data key="$huesat">$presetsfolder/Hue Sat</Data>
<Data key="$imagestatistics">$presetsfolder/Image Statistics</Data>
<Data key="$keyboardshortcuts">$presetsfolder/Keyboard Shortcuts</Data>
<Data key="$layouts">$presetsfolder/Layouts</Data>
<Data key="$lenscorrection">$presetsfolder/Lens Correction</Data>
<Data key="$levels">$presetsfolder/Levels</Data>
<Data key="$liquifymeshes">$presetsfolder/Liquify Meshes</Data>
<Data key="$menucustomization">$presetsfolder/Menu Customization</Data>
<Data key="$optimizedcolors">$presetsfolder/Optimized Colors</Data>
<Data key="$optimizedoutputSettings">$presetsfolder/Optimized Output Settings</Data>
<Data key="$optimizedsettings">$presetsfolder/Optimized Settings</Data>
<Data key="$patterns">$presetsfolder/Patterns</Data>
<Data key="$reducenoise">$presetsfolder/Reduce Noise</Data>
<Data key="$replacecolor">$presetsfolder/Replace Color</Data>
<Data key="$scripts">$presetsfolder/Scripts</Data>
<Data key="$selectivecolor">$presetsfolder/Selective Color</Data>
<Data key="$shadowhighlight">$presetsfolder/Shadow Highlight</Data>
<Data key="$smartsharpen">$presetsfolder/Smart Sharpen</Data>
<Data key="$styles">$presetsfolder/Styles</Data>
<Data key="$textures">$presetsfolder/Textures</Data>
<Data key="$tools">$presetsfolder/Tools</Data>
<Data key="$variations">$presetsfolder/Variations</Data>
<Data key="$webphotogallery">$presetsfolder/Web Photo Gallery</Data>
<Data key="$workspaces">$presetsfolder/Workspaces</Data>
<Data key="$zoomify">$presetsfolder/Zoomify</Data>
<Data key="$hueandsaturation">$presetsfolder/Hue and Saturation</Data>
<Data key="$lights">$presetsfolder/Lights</Data>
<Data key="$materials">$presetsfolder/Materials</Data>
<Data key="$meshes">$presetsfolder/Meshes</Data>
<Data key="$rendersettings">$presetsfolder/Render Settings</Data>
<Data key="$volumes">$presetsfolder/Volumes</Data>
<Data key="$widgets">$presetsfolder/Widgets</Data>
<Data key="$localesfolder">$photoshopappfolder/Locales</Data>
<Data key="$additionalplugins">$localesfolder/$LOCALE/Additional Plug-ins</Data>
<Data key="$additionalpresets">$localesfolder/$LOCALE/Additional Presets</Data>
<Data key="$localeskeyboardshortcuts">$localesfolder/$LOCALE/Additional Presets/$platform/Keyboard Shortcuts</Data>
<Data key="$localesmenucustomization">$localesfolder/$LOCALE/Additional Presets/$platform/Menu Customization</Data>
<Data key="$localesworkspaces">$localesfolder/$LOCALE/Additional Presets/$platform/Workspaces</Data>
<Data key="$automate">$pluginsfolder/Automate</Data>
<Data key="$digimarc">$pluginsfolder/Digimarc</Data>
<Data key="$displacementmaps">$pluginsfolder/Displacement Maps</Data>
<Data key="$effects">$pluginsfolder/Effects</Data>
<Data key="$extensions">$pluginsfolder/Extensions</Data>
<Data key="$fileformats">$pluginsfolder/File Formats</Data>
<Data key="$filters">$pluginsfolder/Filters</Data>
<Data key="$imagestacks">$pluginsfolder/Image Stacks</Data>
<Data key="$importexport">$pluginsfolder/Import-Export</Data>
<Data key="$measurements">$pluginsfolder/Measurements</Data>
<Data key="$panels">$pluginsfolder/Panels</Data>
<Data key="$parser">$pluginsfolder/Parser</Data>
<Data key="$3dengines">$pluginsfolder/3D Engines</Data>
<Data key="$lightingstyles">$pluginsfolder/Filters/Lighting Styles</Data>
<Data key="$matlab">$photoshopappfolder/MATLAB</Data>
<Data key="UserExtensionFolder">$photoshopappfolder</Data>
<Data key="$photoshop">$UserDataFolder/Adobe/Adobe Photoshop CS6/Configuration</Data>
<Data key="DisplayName">Photoshop CS6 32</Data>
<Data key="ProductName">Photoshop32</Data>
<Data key="FamilyName">Photoshop</Data>
<Data key="ProductVersion">13.0</Data>
<Data key="IconPath">Configuration/PS_exman_24px.png</Data>
<Data key="SupportedInSuite">CS6</Data>
<Data key="HostNameForCSXS">PHSP</Data>
<Data key="Bit">32</Data>
</VariableForExMan>
</Configuration>
Please someone help me i cant install any photoshop extension because of this issue,,,Waiting for your reply ...thanks
Here is the results
I installed photoshopcs6 illustrator cs6 dreamweaver cs6 illustrator cs6 in the system , But nothing seems
Result: BridgeTalk Diagnostics
Info:
Name = estoolkit-3.8
Status = PUMPING
Path
Version = 2.0
Build = ES 4.2.12
Next serial number = 40
Logging: = OFF
Now = 15:55:49
Messages:
Message Version = 2.05
Authentication = ON
Digest = ON
Thread: estoolkit-3.8#thread
Avg. pump interval = 55ms
Last pump = 62ms ago
Ping: 7
ECHO_REQUEST: ECHO_RESPONSE
Timeout = undefined
Handler = undefined
STATUS: PUMPING
Timeout = undefined
Handler = undefined
MAIN: MAIN
Timeout = undefined
Handler = installed
LAUNCHED: LAUNCHED
Timeout = undefined
Handler = installed
DIAGNOSTICS: DIAGNOSTICS
Timeout = undefined
Handler = installed
INFO: INFO
Timeout = undefined
Handler = installed
SETUPTIME: thread=0ms, left=16ms
Timeout = undefined
Handler = undefined
Instances: 3
estoolkit-3.8#dbg:
msg[15:55:49]: 00000035
@BT>Version = 2.05
Target = estoolkit-3.8#dbg
Sender = estoolkit-3.8#dbg
Sender-ID = localhost:win3788
Timeout = 15:55:50
Type = Ignore
Response-Request = Timeout
Headers = (no headers)
Timestamp = 15:55:49
Serial-Number = 35
Received = undefined
Result = undefined
Error = undefined
Body = (empty)
Incoming: 1
Outgoing: 0
Handler: 9
ExtendScript = for all messages
Error = for only msg #25
Error = for only msg #27
Error = for only msg #31
Result = for only msg #35
Error = for only msg #35
Timeout = for only msg #35
Result = for only msg #37
Error = for only msg #37
estoolkit-3.8#estk:
msg[15:55:49]: 00000037
@BT>Version = 2.05
Target = estoolkit-3.8#estk
Sender = estoolkit-3.8#dbg
Sender-ID = localhost:win3788
Timeout = 16:05:49
Type = Debug
Response-Request = Result Error
Headers = (no headers)
Timestamp = 15:55:49
Serial-Number = 37
Received = undefined
Result = undefined
Error = undefined
Body: 107 bytes
Text = <get-properties engine="main" object="$.global" exclude="undefined,builtin,prototype" all="true" max="20"/>
Incoming: 1
Outgoing: 0
Handler: 1
ExtendScript = for all messages
estoolkit-3.8: (main)
Incoming: 0
Outgoing: 0
Handler: 1
ExtendScript = for all messages
Targets: 1
Connector = PCD
Installed: 0
Running: 0
exman-6.0:
Path = C:\Program Files\Adobe\Adobe Extension Manager CS6\Adobe Extension Manager CS6.exe
Display Name = Adobe Extension Manager CS6
MsgAuthentication = ON
MsgDigest = ON
ESTK = OFF
BundleID = com.adobe.exman
Status = (not running)
ExeName = Adobe Extension Manager CS6.exe
Installed: 1
Running: 0
Groups = (no groups defined)
Maybe you are looking for
-
How to Create a group for text in XML publisher template
Hi- Can i try to group the several text of lines so that I can split to a different page, in case text exceeds the page length Regards, DMAC
-
my ipod nano is not being recognized by windows 7 when I now try to sync. Is the only way to fix this to uninstall and reinstall itunes and do I then have to redownload all my music?
-
Cannot use hosts file with 10.5.1
Hi, Not sure when this problem creeped in, I think it is since my upgrade to Leopard. The problem is that whatever I put into my /etc/hosts file is not used. Restards, cache flushes do not help. If I have in the hosts file xx.xx.xx.xx anotherHost nsl
-
Scissor tool to divide into several portion midi event in piano roll not affect
Dears all, it seems holding down option in scissor tool mode is not working to divide a midi event in several portions in piano roll. If i press alt the scissor turn in a scissor plus + but not affect. Can you confirm ? Thanks -A
-
Running on a G4 1.42daul, clean install of everything. InDesign is quitting sometimes on startup and sometimes on export to pdf. I have to fix permissions, toss prefs and restart to do anything, and it's getting progressively worse. Any thoughts?