Run a java program by double-click any desktop filetype
hi guys,
i need ur help!!!!!!! i'm tryin to code a program, where i double click on any file type and my coded java program should start running. my coded program should check for th particular in network,if the particular application is not in harddisk......
(eg
double-click on s.pdf file coded java program should start running and search should check for acrobat reader
in network)
pls send a sample code asap!!!!!
regards,
sam
File associations are platform specific. For example on windows they are setup through the registry. On linux I can use Konqueror and it has its way of setting these up or I could use something else. Probably the easiest way is to write your own file explorer that does this.
Similar Messages
-
Run a java program by double-click on desktop file
hi guys,
i need ur help!!!!!!! i'm tryin to code a program, where i double click on any file type and my coded java program should start running. my coded program should check for th particular in network,if the particular application is not in harddisk......
(eg
double-click on s.pdf file coded java program should start running and search should check for acrobat reader
in network)
pls send a sample code asap!!!!!Did you started any coding on this or just looking for
a complete solution from the memebers of JDC??i think you've got it...
could you please stop posting this message
http://forums.java.sun.com/thread.jsp?thread=207687&forum=4&message=705223
http://forums.java.sun.com/thread.jsp?thread=207185&forum=4&message=702579
http://forums.java.sun.com/thread.jsp?thread=207950&forum=4&message=706537
plus this one
and all the old posts about opening files including this one...
http://forums.java.sun.com/thread.jsp?thread=206532&forum=4&message=699027
maybe you should try and actually write some code on your own... -
Open a file in a running java program via double click
I have already implemented opening my program with the corresponding file after a double click in windows explorer or from the cmd line but how do you open a file into the program if it is already running as MS Word will open a .doc file in the current word instance if you are running it.
Thx,
JimImplement some sort of interprocess communication in your program. If you launch an instance, it can check whether another is running and pass a message to it telling it to perform the wished action.
-
JSP codes for running a JAVA program
hello...
does anyone know the JSP codes for running a Java program from my web page?? i mean i already have my java program compiled... and i just want this java program to run in the background when I click on a button or a link...
Any idea about this?
plz advice..
aviyes... u r somewhat right... but this runs on Jakarta Tomcat...
i'm using the Apache Http Server together with the ServletExec AS which enable the Apache server to run JSP..
I've created a package where i've put my classes...
WEB-INF/classes/tbd(package name)/my classes
and i've added.. package name.. in my java program..
and then in jsp... i've written..
<%@ page import="tdb.*"%>
<jsp:useBean id="exec" class="tdb.textdb" />
<%exec.convert_data();%>
but when i run the page it says the package does not exist...
can anyone tell where to place the folder WEB-INF so that it can run fine?
thx
avi -
I start running a java program and when i switch users the sound doesnt work
When I start running a java program or leave a game running and i switch users the sound doesnt work. I have been searching around the web and nobody seems to have an answer. This just recently started to happen. Please if anyone has any ideas that would be much appreciated and the problem is my computer its almost brand new. And my computer is completely up to date.
Sony Mobile team has a separate community which can be found here.
If my post answers your question, please click on "Accept as Solution" -
Running a java program a set number of times
This is a general question. Is it possible to make a java program run only 5 times for the sake of arguement.
Basically I want to write a program that will give the user some flexibility when it will actually run another Java program, but I only want them to be able to say "not now' for a set number of times. When the last time comes the other program will launch. I was initially thinking of the Do Whilw loop, but this needs to work when the program is restarted.
Program starts, it has 5 times it will run before it does something else(doesn't really matter now I think). User takes option "Not Now" and the program ends, but warns the user this will run 4 more times before you will need to do something.
This process will repeat until the user takes the option "Ok install now" or the time limit expires and the install occurs anyway. Can someone point me in the right direction.ok I see so it's like one those programs that you download for free on the internet and they give you a set amount times to use it before you have to pay for it. but in this case when the number of times you use it equals 5 (or when the user clicks ok) a different java app will open automatically.
My first thought would be to Write a Serialized object to disk using objectOutputStream that stores the number of times the application has been opened. and each time the program runs it checks for the serialized object and then you can do something like what I posted before. of course if were worried about security the user could always look for the object and erase it, if so then I guess we would have to come up with another plan of attack
Hope this helps -
Running a java program from an icon
I want to run my program from an icon on my desktop. I have a .bat file that I've built a shortcut to and it works.MY GUI program does display and run when I click on the icon. The problem is that the DOS window also shows up behind my GUI.
Is there anyway to prevent the DOS window from showing? Or is there another way to run a Java program without resorting to a DOS command line or running it through FORTE or another IDD?Chris's solution worked well, with one small problem. Once my GUI starts, it takes up the whole screen. Normally when I run it, it appears as a small window.
not a big problem, I can reduce it easily after it starts. But does anyone know a way to make it come up in the reduced size it norally comes up in when I run it from my IDE? -
Running a java program in a directory other than the current directory
How do I run a java program that's located in a directory other than the current directory?
There is a file Test.java in /dir1/subdir1. If my current directory is anywhere other than that directory, say /dir2/subdir2, I can compile Test.java by using:
javac -classpath /dir1/subdir1 /dir1/subdir1/Test.java
But when I try to run it with:
java -classpath /dir1/subdir1 /dir1/subdir1/Test
I get a java.lang.NoClassDefFoundError: \dir1\subdir1\Test
Any thoughts?You need to specify just the name of the class you want to run. So java -classpath /dir1/subdir1 Test
-
Exception while Running a Java Program for UME.
Hi Experts,
I am trying to run a java program to acess UME. Its a sample to create user but all of my samples are throwing this exception in NWDS (Console).Can anyone tell me why is it throwing this exception .
com.sap.security.api.UMRuntimeException: UME factory 'com.sap.security.api.IUserFactory' cannot be accessed because UME initialization has not started yet.
Please check
UMFactory.isInitialized() before using UME functionality.
at com.sap.security.api.UMFactory.checkInitialized(UMFactory.java:1019)
at com.sap.security.api.UMFactory.getUserFactory(UMFactory.java:801)
at Search.main(Search.java:25)
Exception in thread "main"
Thanks in advance
SomilHi,
Earlier i faced the same exception when i tried to call the UME form Standalone java application,To resolve this i used stateless session bean approach. i follow the Below Mentioned Steps,
1:-- create an J2EE -- EJB module project.
2:-- Create stateless session bean and define the require methods ,implement Local and remote interface methods in your bean class.
3:-- refer the UME apis in EJB Projects build path.
4:-- Call UME in Bean class methods.Build the EJB project and Archive.
5:--Now create an Enterprise application Project ,Include the EJB module project to your EA Project by right clicking on EA project.Build EA project and EAR file
6:--Deploy the EAR file on your server.
7:--Now from your standalone java application include these two projects in Project tab of your Application.
8:--Lookup the stateless session bean in your java class by its default JNDI name ,Obtain remote or local Home interface,And execute the BEAN Method which deals with UME.
You can also refer this tutorial in some parts of it UME apis(like IUser,UMFactory) are used in Servelets and EJB ,You can download this tutorial source from SDN for your reference.
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/297f35cf-0201-0010-00b2-fe2f3e23d360
Siddharth -
How to set path to run a Java program?
my pc os is win2000 service pack 3.
cpu is celoron 667mhz
256 pc133 sdram
i have done the setting b4 run a java program but no any effect.
setting as below:
set path=c:\j2sdk1.4.1_01\bin
set classpath=c:\j2sdk1.4.1_01\lib
my java file is store in C:\Java, file name is HelloWorld.java, so when i type:
C:\>
C:\>Java\javac HelloWorld.java
(the screen show me : java\javac not internal or external........")
and i try again as follow:
C:>
C:>\Java>javac HelloWorld.java
(the screen show : Exception in thread "main" java.lang.NoClassDefFoundError:HelloWorld/java)
i cant do anymore, who can help me?you need to put the CLASSPATH to dir: c:\j2sdk1.4.1_01
and also to the directory you are working
For example, you are working in "C:\Myclasses". You need to put:
set CLASSPATH = C:\j2sk1.4.1_01;C:\Myclasses;
if you don't put your working directory, java doesn't find your classes
Try it and luck! -
URGENT: How to run a Java program from a different directory?
Hi.
How do I run a Java program from a directory that the file is not located in? So lets say im in c:\Java. But the file is in c:\Java\abc\efg\.
What would be the command to run the Java file from c:\Java.
I can't remember it and I need it asap.
Cheers.If the class you are trying to run is MyApp.class, try
c:\Java\>java -cp abc\efg MyAppThe actual classpath you specify will depend on whether or not MyApp.class is in a package (I've assumed it isn't) and whether or not any 3rd party jars are involbed (I've assumed not).
Edited by: pbrockway2 on Apr 1, 2008 6:42 PM
The command arguments read as "Run the MyApp class using as a classpath abc\efg relative to here (c:\Java)". -
I am not able to run the java Program
Hi All,
I am not able to run a java program... I am able to complie the program sucessfully when i am trying to run it i am getting a error:
Exception in thread "main" java.lang.NoClassFoundError : filename
i have complie and run my programs frequently but now i am not able run my prevoius examples also ...
Can u any body help me out...... I have also update the latest version of JRE but still my problem is not sloved.
Thanks & Regards,
RaviMake sure you take package structure into account.
If you have say
package testing.things;
public class Test
public static void main(String[] args)
System.out.println("World Hello");
}in file Test.java, you compile it with (assuming your current working directory is at the folder in which the source file is located).
javac -d . Test.javaand run it with
java testing.things.TestThe -d . option creates the output at the current directory (with a folder structure matching your package structure).
# -
Help needed in running a java program
hi
how to run a java program using another java program.
i have tried a litte to run the notepad,mspaint applications sucessfully using the Runtime class,but how to specify a java program init . the program is given below
public class cls
public static void main(String args[])
Runtime r=Runtime.getRuntime();
Process p=null;
try{
p=r.exec("notepad" );}
catch(Exception e) {
System.out.println("error on execution");
}to run another java program how to modify the exec() or any other way to do this.thank u
its working without any error but it doesn't print any thing on the screen.
the program is
this program to be run by cls.java
// hello.java
import java.io.*;
public class hello
public static void main(String[] args)
System.out.println("hello world");
}cls.java is given below
//cls.java
public class cls
public static void main(String args[])
Runtime r=Runtime.getRuntime();
Process p=null;
try{
p=r.exec("java hello" );}
catch(Exception e) {
System.out.println("error on execution");
} -
Running a java program with eclipse
Hi,
I'm trying to run this java program(below) in eclipse..when i go to the 'run' icon inorder to choose the option 'run as' then 'java application' , i have 'none applicable' as the only option available. is it possibly because the program uses threads?
could someone using eclipse please try to execute this program and let me know if you succeed and how exactly you do it.
package reseaux;
import java.io.*;
import java.net.*;
import java.util.*;
public class LeServeur extends Thread{
Socket socket;
BufferedReader in;
PrintWriter out;
Vector FlowList=new Vector(10);
public LeServeur(Socket socket)throws IOException{
this.socket=socket;
in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
out= new PrintWriter(new OutputStreamWriter(socket.getOutputStream()));
public void run(){
String s;
synchronized(FlowList){
FlowList.addElement(this);
try{
while(!(s = in.readLine()).equalsIgnoreCase("/quit")){
for(int i=0;i<FlowList.size();i++){
synchronized(FlowList){
LeServeur monServeur=(LeServeur)FlowList.elementAt(i);
monServeur.out.println(s + "\r");
monServeur.out.flush();
catch(IOException e){
e.printStackTrace();
finally {
try {
in.close();
out.close();
socket.close();
} catch(IOException ioe) {
} finally {
synchronized(FlowList) {
FlowList.removeElement(this);
thanksthanks...
Infact, i wanted to run the main program called 'Serveur' but it uses 'LeServeur'( the code i sent before') and apparently it gives me an error msg that it doesnot recognise the 'LeServeur'...that's why i was thinking that i should probably first compile the 'LeServeur' so that it can be recognised in the 'Serveur' program.
here is the 'Serveur' code that uses an instantiation of the LeServeur...
package reseaux;
import java.net.*;
import java.io.*;
public class Serveur {
public int port;
public ServerSocket skt;
public Socket socket;
public static void main(String[] args) {
int port=8975;
ServerSocket skt=null;
Socket socket=null;
try{
if(args.length>0)
port=Integer.parseInt(args[0]);
catch(NumberFormatException n){
System.out.println("This port is used uniquely for listening");
System.exit(0);
try{
skt= new ServerSocket(port);
while (true){
socket =skt.accept();
LeServeur flow=new LeServeur();
flow.start();
catch(IOException e){
e.printStackTrace();
finally{
try{
skt.close();
catch(IOException e){
e.printStackTrace();
do you know have any idea why it doesnt recognise the 'LeServeur'?
ps:they're in the same package
thanks -
Running a java program from a .asp page
i'm looking for someone in the community that knows how to run a java program
on a web server ( not an applet) from a asp page. The server as IIS 5 and the jre1.3.1
any help or tips would be welcomedThe following site explains in detail how you have to do it. I have done it and it works fine.
If u still have problems, contact me at [email protected]
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q167941
Maybe you are looking for
-
Creating entries in customer/vendor balance without posting
Hi, I like to know is there anyway to add customer/vendor balance without posting that impacting the book? Sample like interest calculation to be keep track into customer balance but there is no FI posting that impacting the book. When i displaying c
-
Help, I am trying to update My Microsoft Office 2011 14.4.2 for mac update cannot close Microsoft Database Daemon or SyncServices Agent how do I do this please?
-
Warning due to check scheduling date
Dear SAP GURU I release production order & check all log. when i chen log for scheduling they give messege "START DATE IN THE PAST TODAY SCEDULING" i made all necessary setting for scheduling in routing, float,customization in scheduling" what is the
-
Hi, I am trying to enable logging for Certificate Services Network Device Enrollment Service (NDES). I am following the instructions in the book "Windows Server 2008 PKI and Certificate Security" on page 694. As the instructions indicated, I logged
-
Blue Screen, can't restore.
So I bought this iPod touch, 5th gen for 200 bucks in July. It was working fine until yesterday, I went to update it to iOs 6.0, it died in the middle of the update, so I went to charge it. I turned it on only to find a blue screen, I did a manual