LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-13-2003, 10:38 AM   #1
karleong
LQ Newbie
 
Registered: Jul 2003
Location: malaysia
Posts: 21

Rep: Reputation: 15
How to run java class everyday automatic??


Does anyone can teach me how to run a java class everyday automatic in linux or apache??
I had try many thing but no use.
please help! THANKS!!
 
Old 07-13-2003, 10:53 AM   #2
Mathieu
Senior Member
 
Registered: Feb 2001
Location: Montreal, Quebec, Canada
Distribution: RedHat, Fedora, CentOS, SUSE
Posts: 1,403

Rep: Reputation: 46
You can setup a Cron Job.

http://www.realitywebs.com/unix/cron.shtml
http://www.linuxinstruct.com/tutorials/cron/
 
Old 07-13-2003, 01:20 PM   #3
german
Member
 
Registered: Jul 2003
Location: Toronto, Canada
Distribution: Debian etch, Gentoo
Posts: 312

Rep: Reputation: 30
make a shell script that runs it, then call it from cron.

#!/bin/sh

JAVA_BIN=/usr/java/j2sdk1.4.1_02/bin/java
CLASSPATH=/home/jamin/classes:/home/jamin/jbproject

$JAVA_BIN -cp $CLASSPATH name.of.some.Class -arg

Then edit cron.daily or monthly or whatever and add a line that runs the script.

HTH

B.
 
Old 07-14-2003, 09:58 AM   #4
karleong
LQ Newbie
 
Registered: Jul 2003
Location: malaysia
Posts: 21

Original Poster
Rep: Reputation: 15
How to edit CLASSPATH?
If my class is locate in /root/HelloWorld.class.
 
Old 07-14-2003, 12:47 PM   #5
german
Member
 
Registered: Jul 2003
Location: Toronto, Canada
Distribution: Debian etch, Gentoo
Posts: 312

Rep: Reputation: 30
I assume that the .java file does not have a package declaration at the top, like

package com.me.my.thing;

because if it does you will (in the case above) have to put it in

/root/com/me/my/thing/HelloWorld.class

anyway just type (or add to a shell script)

CLASSPATH=$CLASSPATH:/root

then try

java HelloWorld

HTH

B.
 
Old 07-15-2003, 07:51 AM   #6
karleong
LQ Newbie
 
Registered: Jul 2003
Location: malaysia
Posts: 21

Original Poster
Rep: Reputation: 15
Thanks for your help!!
It's work!!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
java tree class true_atlantis Programming 1 08-30-2005 12:03 PM
Running a Java executable class from another executable class LUB997 Programming 22 07-24-2005 04:57 AM
Java Question on using your own class k1ll3r_x Programming 2 01-22-2005 10:11 AM
Compile Java - .class, .java, .jar ? woranl Programming 2 11-09-2004 10:12 PM
can't run java class files in linux JIV Programming 6 03-25-2003 01:20 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:36 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration