| create a new windows (xp) service that runs a jar file |
|
 |
Index ‹ java-programmer
|
- Previous
- 3
- do XML/XSD validation with Ant 1.5.4 and JDK 1.4.2. How?Buried somewhere in the documentation for the 1.4 JDK is a statement that
the included XML parser class cannot do schema validation (DTD validation:
yes, Schema validation: no). However, I believe that Ant uses the XML
parser in its ANT_HOME/lib directory. You probably have an older xerxes.jar
and the your best bet is to delete that and download the latest xerces.jar
and drop it into the ANT_HOME/lib directory.
<email***@***.com> wrote in message
news:email***@***.com...
> I really need to be able to validate XML against an XSD, using Ant
> 1.5.4 and JDK 1.4.2. It appears this is straightforward to do with the
> latest Ant release and/or the latest JDK, but not with the releases
> that I'm limited to.
>
> I noticed the "iso-relax" sourceforge project, which includes the JARV
> library (which contains the Ant task). This was promising, but it
> causes an NPE to be thrown in Xerces' XMLSchemaValidator class, and I
> have no idea why.
>
> I'm querying the ant-user mlist about this, but I figured this would be
> another good place to try.
>
- 5
- JSP codeHi,
I have the following code
<html>
<head>
<title>
Authentication
</title>
</head>
<body>
<%!
private String username = null;
private String password = null;
private boolean completeLoginInformation=true;
%>
<%
username = request.getParameter("username");
password = request.getParameter("password");
%>
<H2><p>Checking authentication...</p></H2>
<%
if (username == null)
{ completeLoginInformation = false;
%><p><H3>Username has been left empty...</H3></p>
<% } %>
<%
if (password == null)
{ completeLoginInformation = false;
%><p><H3>Password has been left empty...</H3></p>
<% } %>
<% if (completeLoginInformation == false) { %>
<p><a href="http://localhost:8080/jsp-examples/cal/Front.jsp">Return
back to Front Page</a></p>
<p><a href="http://localhost:8080/jsp-examples/cal/AdminLog.jsp">Return
back to Administration Authentication</a></p>
<% } else { %>
<p>Need to search in database</p>
<p>All data has been entered</p>
<% } %>
</body>
</html>
Now when username and password arguments are given as empty, the flag
is supposed to be set free and in the web browser shows me the 2 links
given. Instead, the else part is being given.
Can someone help me out
Thanks in Advance
- 6
- JTabel and JScrollPane doens't scrollHello,
I have a problem with a larger table.
I have a JTable whiches model contains 38 columns.
I put this Table in a JScrollPane. But on the screen there is no
scrollbar but a table with 38 very small columns.
I thought there must be a scroll bar for horizontal scrolling instead.
Are there any traps in this?
kind regards
Falko
- 6
- new error building jdk14I've been having quit a bit of difficulty getting jdk14 built on my new
machine. I think this is a heretofore unreported error.
uname -a output:
FreeBSD new.cognitiongroup.biz 5.4-RELEASE FreeBSD 5.4-RELEASE #0: Sun
May 8 07:00:26 UTC 2005
email***@***.com:/usr/obj/usr/src/sys/GENERIC amd64
The build crashes when it tries to compile interpreterRT_i486.cpp
because it has some ABSTRACT methods defined. I'm shocked that the
build would break because it generates code that can't be compiled.
But, I suspect it's a setting, configuration file, or something simple
because others seem to be getting their jdk14 compiled fine.
Here's the abridged build output:
==============================================================
===> Vulnerability check disabled, database not found
LIBC_R TEST PASSED: All Ok
IMPORTANT: To build JDK 1.4.2 port, you should have at least
1.7Gb of free disk space in build area!
IMPORTANT: To build JDK 1.4.2 port, you should have linux emulation
enabled in the kernel and linux procfs (linprocfs) filesystem
mounted.
Following port compile time options are available:
WITH_DEBUG - install JDK binaries and libraries
with debuging support
MINIMAL - don't build/install mozilla java
plugin, javaws and JDK demos
WITH_IPV6 - enable JDK IPv6 support
===> Extracting for jdk-1.4.2p7
=> Checksum OK for j2sdk-1_4_2-src-scsl.zip.
=> Checksum OK for j2sdk-1_4_2-bin-scsl.zip.
=> Checksum OK for bsd-jdk14-patches-7.tar.gz.
===> jdk-1.4.2p7 depends on executable: zip - found
===> jdk-1.4.2p7 depends on executable: unzip - found
===> Patching for jdk-1.4.2p7
Hmm... Looks like a unified diff to me...
The text leading up to this was:
<snip: patching output>
WARNING: Your build environment has the variable DEV_ONLY
defined. This will result in a development-only
build of the J2SE workspace, lacking the documentation
build and installation bundles.
Sanity check passed.
/bin/mkdir -p ../build/bsd-amd64/hotspot-amd64/tmp
(cd ./../build/bsd-amd64/hotspot-amd64/tmp; \
gmake -f /usr/ports/java/jdk14/work/hotspot/build/bsd/Makefile product \
HOTSPOT_BUILD_VERSION=1.4.2-p7-rschilling_04_nov_2005_11_18
LP64=1 GAMMADIR=/usr/ports/java/jdk14/work/hotspot ; )
gmake[1]: Entering directory
`/usr/ports/java/jdk14/work/control/build/bsd-amd64/hotspot-amd64/tmp'
sh /usr/ports/java/jdk14/work/hotspot/build/bsd/makefiles/buildATree.sh
compiler2 /usr/ports/java/jdk14/work/hotspot bsd i486
(cd bsd_i486_compiler2/product; gmake)
gmake[2]: Entering directory
`/usr/ports/java/jdk14/work/control/build/bsd-amd64/hotspot-amd64/tmp/bsd_i486_compiler2/product'
Removing ../generated/includeDB.current to force regeneration.
cd ../generated; cat
/usr/ports/java/jdk14/work/hotspot/src/share/vm/includeDB_core
/usr/ports/java/jdk14/work/hotspot/src/share/vm/includeDB_gc
/usr/ports/java/jdk14/work/hotspot/src/share/vm/gc_implementation/includeDB_gc_parallelScavenge
/usr/ports/java/jdk14/work/hotspot/src/share/vm/gc_implementation/includeDB_gc_shared
/usr/ports/java/jdk14/work/hotspot/src/share/vm/includeDB_ci
/usr/ports/java/jdk14/work/hotspot/src/share/vm/includeDB_compiler2 >
includeDB
cd ../generated; if [ ! -r incls ] ; then \
mkdir incls ; \
fi
cd ../generated; /usr/local/linux-sun-jdk1.4.2/bin/java -classpath .
MakeDeps diffs UnixPlatform platform.current includeDB.current
/usr/ports/java/jdk14/work/hotspot/build/bsd/platform_i486 includeDB
-firstFile functionAtStart.cpp -lastFile functionAtEnd.cpp
Old database:
computing closures
New database:
reading database: includeDB
computing closures
Deltas:
updating output files
The order of .c or .s has changed, or the grand include file has changed.
writing individual include files
creating functionAtStart.cpp
creating accessFlags.cpp
creating allocation.cpp
creating aprofiler.cpp
creating arguments.cpp
<snip: some output deleted due to length>
creating functionAtEnd.cpp
writing grand include file
writing dependencies file
cd ../generated; cp includeDB includeDB.current
cd ../generated; cp
/usr/ports/java/jdk14/work/hotspot/build/bsd/platform_i486 platform.current
gmake[3]: Entering directory
`/usr/ports/java/jdk14/work/control/build/bsd-amd64/hotspot-amd64/tmp/bsd_i486_compiler2/product'
<snip: more build output omitted, the error is next>
Compiling
/usr/ports/java/jdk14/work/hotspot/src/cpu/i486/vm/interp_masm_i486.cpp
Compiling
/usr/ports/java/jdk14/work/hotspot/src/cpu/i486/vm/interpreterRT_i486.cpp
/usr/ports/java/jdk14/work/hotspot/src/cpu/i486/vm/interpreterRT_i486.cpp:
In static member function `static void
SignatureHandlerLibrary::add(methodHandle)':
/usr/ports/java/jdk14/work/hotspot/src/cpu/i486/vm/interpreterRT_i486.cpp:83:
error: cannot allocate an object of type
`InterpreterRuntime::SignatureHandlerGenerator'
/usr/ports/java/jdk14/work/hotspot/src/cpu/i486/vm/interpreterRT_i486.cpp:83:
error: because the following virtual functions are abstract:
/usr/ports/java/jdk14/work/hotspot/src/share/vm/runtime/signature.hpp:283:
error: virtual void NativeSignatureIterator::pass_float()
/usr/ports/java/jdk14/work/hotspot/src/share/vm/runtime/signature.hpp:284:
error: virtual void NativeSignatureIterator::pass_double()
/usr/ports/java/jdk14/work/hotspot/src/cpu/i486/vm/interpreterRT_i486.cpp:
In static member function `static u_char*
InterpreterRuntime::slow_signature_handler(JavaThread*, methodOopDesc*,
jint*, jint*)':
/usr/ports/java/jdk14/work/hotspot/src/cpu/i486/vm/interpreterRT_i486.cpp:156:
error: cannot allocate an object of type `SlowSignatureHandler'
/usr/ports/java/jdk14/work/hotspot/src/cpu/i486/vm/interpreterRT_i486.cpp:156:
error: because the
following virtual functions are abstract:
/usr/ports/java/jdk14/work/hotspot/src/share/vm/runtime/signature.hpp:283:
error: virtual void NativeSignatureIterator::pass_float()
/usr/ports/java/jdk14/work/hotspot/src/share/vm/runtime/signature.hpp:284:
error: virtual void NativeSignatureIterator::pass_double()
gmake[3]: *** [interpreterRT_i486.o] Error 1
gmake[3]: Leaving directory
`/usr/ports/java/jdk14/work/control/build/bsd-amd64/hotspot-amd64/tmp/bsd_i486_compiler2/product'
gmake[2]: *** [the_vm] Error 2
gmake[2]: Leaving directory
`/usr/ports/java/jdk14/work/control/build/bsd-amd64/hotspot-amd64/tmp/bsd_i486_compiler2/product'
gmake[1]: *** [product] Error 2
gmake[1]: Leaving directory
`/usr/ports/java/jdk14/work/control/build/bsd-amd64/hotspot-amd64/tmp'
gmake: *** [product] Error 2
*** Error code 2
Stop in /usr/ports/java/jdk14.
==============================================================
_______________________________________________
email***@***.com mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-java
To unsubscribe, send any mail to "email***@***.com"
- 7
- Problems in printing an IntegerHamvil ha scritto:
> 1) why I get the blank page instead of the usual exception in the jsp
> page?
Ok, I've fixed this (it was a problem with the configuration of the
logger
> 2) why the variable cannot be printed?
In the logger i get the following message:
javax.servlet.jsp.JspException: Cannot find message resources under key
org.apache.struts.action.MESSAGE
What I do not understand is why struts looks for a key in the resources
file. It should just print the integer. Am I missing somethink?
BTW if I add the following in the struts-config the problem look fixed.
Is this the right approach?
<message-resources
parameter="MyWebAppResources"
null="false" />
Thanks
- 7
- Java In A Nutshell, 5th Edition moreWith more than 700,000 copies sold to date, Java in a Nutshell from
O'Reilly is clearly the favorite resource amongst the legion of
developers and programmers using Java technology. And now, with the
release of the 5.0 version of Java, O'Reilly has given the book that
defined the "in a Nutshell" category another impressive tune-up.
In this latest revision, readers will find Java in a Nutshell, 5th
Edition does more than just cover the extensive changes implicit in
5.0, the newest version of Java. It's undergone a complete makeover--in
scope, size, and type of coverage--in order to more closely meet the
needs of the modern Java programmer.
more http://www.cdbook.cn/book.asp?id=676
- 7
- I really need help with this so if anyone can help me out that would be really great of you.On Feb 6, 9:12 pm, Lew <email***@***.com> wrote:
> email***@***.com wrote:
> >> Part II
>
> >> To make a profit a local store marks up the prices of its items by
> >> 25%. Write a Java program that declares the following variables:
> >> 1. a double variable named percent_markedup
> >> 2. a double variable named original_price
> >> 3. a double variable named sales_tax_rate
>
> >> In your program be sure to assign a value to each of the variables 1-3
> >> above. Use initialization for 1 and 2 and for 3.
>
> >> Using the information from above, the program should then output:
> >> 1. the original price of the item
> >> 2. the marked-up percentage of the item (original price times percent
> >> of markup)
> >> 3. the store's selling price of the item
> >> 4. the sales tax rate
> >> 5. the sales tax
> >> 6. the final price of the item (the final price of the item is the
> >> selling price plus the sales tax)
>
> >> can u send me an email or using this to communicate.
>
> Please do not use textspeak in Usenet posts.
>
> A couple of points about your assignment that you will need to know if you
> ever use Java outside of school:
>
> - by long-standing and nearly rigid convention, Java variables are spelled
> without underscores and with mixed case, capitalizing each word part except
> the first, hence "percentMarkedUp".
>
> - doubles work fine as currency values for academic work, but not so much in
> the real world. The issues are somewhat complex, so we stick with doubles
> until we've learned some more of the basics.
>
> Let's review your assignment piece by piece:
>
> >> Write a Java program
>
> I'll give you this part. A "Java program" is a class with a properly-defined
> main() method.
>
> package programming.oneohone;
> public class RetailModel
> {
> public void main( String [] args )
> {
> }
>
> }
> >> that declares the following variables
>
> There are two places you could declare variables so far, within the class
> itself as instance or class variables, or within the main() method. The
> main() method is simpler, so start there.
>
> >> 1. a double variable named percent_markedup
> >> 2. a double variable named original_price
> >> 3. a double variable named sales_tax_rate
>
> Do you know how to declare variables? I'll give you one, focusing in on just
> the main() method and not the rest of the class.
>
> public void main( String [] args )
> {
> double percent_markedup;
> }
>
> It's the same for the others.
>
> >> In your program be sure to assign a value to each of the variables 1-3
> >> above. Use initialization for 1 and 2 and for 3.
>
> Well, the declaration of 1. that I showed you doesn't assign a value, because
> it doesn't have an initialization clause.
>
> Yet.
>
> The tutorial gives a hint near the top of the page about initialization, in
> case you forget the course information:
> <http://java.sun.com/docs/books/tutorial/java/nutsandbolts/variables.html>
>
> So go ahead and modify the declarations you just wrote and add the
> initializations.
>
> Solve one itty-bitty problem at a time, and make sure your program is correct
> at each stage. Only then add in the next piece of the puzzle, one itty-bitty
> problem at a time.
>
> This is beginning to sound a lot like Patricia Shanahan's advice, isn't it?
> You should go back to her link and read it again, very carefully.
>
> Quiz: Where (in what file) do you store the source code for your RetailModel
> program?
>
> General advice: Read the rest of the tutorial, not just the one page I linked
> you to.
>
> --
> Lew
hey Lew thank you soo soo much that instruction by instruction really
helped me a lot and thank you so much again.
- 7
- short circuit operatorsOn Feb 25, 5:19 pm, Patricia Shanahan <email***@***.com> wrote:
> k-e-n wrote:
>
> ...
>
> > Also as I mention in the list below it is simply not good practice to
> > mix Bitwise and Boolean operators in the same expression, just because
> > you can, does not mean you should.
> ...
> > 3. And I think most important of all: Do Not Mix Boolean Operators and
> > Bitwise Operators in the Same Expression.
>
> Note that "|" and "&" with boolean operands, such as true and false, are
> not bitwise operations. They are boolean operations without
> short-circuiting, so that the right hand side is evaluated regardless of
> the left hand side value. They are only bitwise operators if applied to
> integer operands.
>
> What is wrong with mixing bitwise and boolean operators in the same
> expression? Suppose I want to do something if a particular bit is on in
> either of two ints:
>
> if( (intA & mask) || (intB & mask) )
>
> seems reasonable to me, but it definitely mixes bitwise and boolean
> operations. How would you do it?
>
> Patricia
I would do it as you have done and as Joshua Cranmer suggests, use
parenthesis to make the precedence and more specifically your intent
clear.
To a programmer the parenthesis are sufficient advice, to someone who
seems not to understand precedence or perhaps more specifically wants
to know why the rule(s)
exists and what is the meta-rule behind that, I felt something
stronger was required.
Did you have any problem with any other parts of my comment? I have no
wish to cause offense or create any controversy.
- 7
- How to start compiling a big package directory tree ?I downloaded a java source of a tool which is spread over multiple (40-50) *.java files
which are located in different sub directories according to their package name.
Unfortunately no further instructions (e.g. Ant script) are available.
However the source should be compileable without errors.
How do I start ?
Which class should I compile first ?
For example I found a "main()" method in java file SomeGUI.java
When I switch now to the base directory of package:
D:\java\base\
and type at the command prompt:
javac org\somepack1\subpack2\SomeGUI.java
then the compiler tell me that he cannot find a file/package "org.somepack.addclass"
But the java file org\soempack\addclass.java EXISTS !
Why does the compiler not find this class/source ?
Can I somehow tell the compiler (from the command line !):
"here is the source directory tree. Search for all you need and compile all
necessary classes in the sequence you need".
Tom
- 8
- Many to Many CMR with an attributeHi,
I have a db scheme where i have a Many to Many relation but i have to
store an attribute in the mapping table. Then, i thought i could
transform my N-N relation in two 1-N relation, explicitely creating the
mapping table with my own attribute but this table has no primary key
(actually it should be the composition of the two foreign keys). Is it
possible to create an Entity where primary keys is the composition of 2
CMR fields or is there another way to do something like that ?
The db :
Supplier(id, name, ...) <-*--(quantity)--*-> Item(id, name, ..)
which is actually
Supplier(id, name, ...) <-1--*-> Supplier_Item(sup_id, item_id,
quantity) <-*--1-> Item(id, name, ...)
Thanks.
- 8
- copying Image to system clipboardHi
As far as I can tell this is not possible to copy an Image to the
system clipboard with java at the moment. However I need it for a
project I'm working on. Has anyone found any hacks to make this
possible? Also, are there any chances that this feature will be
incorporated into the JDK at some point in the future? Are plans in the
offing?
Thanks for any advice.
Michael
- 8
- Clipboard doesn't see changes to the system-clipboard...I have an signed Applet with a JTable, where I have implemented
"cut & paste" to/from the system clipboard.
(The applet is signed to get access to the system clipboard).
Everything works as expected; Copying a row from ie. Excel,
and pasting it into a JTable row, or the other way around.
But... After I do a "local" copy/paste, that is, copy a row from
my JTable, and pasting it into another row, the Applet doesn't see
changes to the system-clipboard anymore. If I after this copy a new
row out of Excel, and try to paste it into my Applet table, what I get
is the old data from my last "local" copy-paste operation.
Anyone seen this behaviour before?
Any hints?
TIA...
- 9
- What Collection to use?Dear all,
My app can load files using a FileChooser. I would like to store the
last 4 loaded file pathes so I can use them later (ie fast access to
last used files). I'm looking for the perfect Collection to store these
4 File objects.
I think it should have the following properties
1. no duplicate objects
2. knowing the insert order (so you know which was last entered)
3. limited size (4 objects) and throwing out the oldest entry when
inserting a new one (like a ring buffer maybe)
Is there such a Collection already or do I have to homecook one?
Thanks for your answers
Phil
PS: Is there a summary table on the web with all properties of the
standard subclasses of Collection and Map?
- 9
- JDK1.5 with JbossGreetings,
I want to try and work with some EJB3 stuff for a small website hosted on a
FreeBSD 5.4 server and was wondering at the state of JDK1.5 port and if it
is ok to use it with Jboss under FreeBSD.
Thanks
John
- 16
- Job for the Position of Project Lead in a MNC at BangaloreCompany Profile :
The company is an ISO 9001:2000 Quality certified company, is in the
business of providing world-class software solutions and support
services to its clients. Located in Bangalore. They provide IT
services across various domains such as Insurance, Financial Services,
Travel, Retail, and Logistics etc. They have been building customized
applications that have robust layers of application architecture.
Job Profile :
Incumbent should have hands on in Core Java, MVC Architecture, Design
Patterns,J2EE, Struts,EJB, MySQL
Must have knowledge of APEX.
Should have min 6 yrs of exp
Should have good oral and written communication and good analytical
skills
Job location: Bangalore
Salary wont be a constraint for the right candidate.
If you are interested..send me your updated resume as soon as
possible email***@***.com
|
| Author |
Message |
JPractitioner

|
Posted: 2006-7-5 17:34:00 |
Top |
java-programmer, create a new windows (xp) service that runs a jar file
Hello guys,
Does anyone has experience/know how to create a new windows (xp)
service that runs a jar file? This issue rises as i need to hide the
most of the java implementation in this project before it goes live.
So the idea is, to have control on the exceution of the jar from
windows windows service console (which the users can define the startup
type i.e. manual, automatic, disabled and the running life cycle i.e.
start, stop, pause, resume, restart...).
so any leads to solving this will be appreciated.
Thanks in advance. Have a nice day!
|
| |
|
| |
 |
dsjoblom

|
Posted: 2006-7-5 22:42:00 |
Top |
java-programmer >> create a new windows (xp) service that runs a jar file
JPractitioner wrote:
> Hello guys,
>
> Does anyone has experience/know how to create a new windows (xp)
> service that runs a jar file? This issue rises as i need to hide the
> most of the java implementation in this project before it goes live.
>
> So the idea is, to have control on the exceution of the jar from
> windows windows service console (which the users can define the startup
> type i.e. manual, automatic, disabled and the running life cycle i.e.
> start, stop, pause, resume, restart...).
>
> so any leads to solving this will be appreciated.
>
> Thanks in advance. Have a nice day!
I imagine you would create it like any other windows service. See
http://support.microsoft.com/kb/q137890/
Regards,
Daniel Sj鯾lom
|
| |
|
| |
 |
Real Gagnon

|
Posted: 2006-7-6 0:35:00 |
Top |
java-programmer >> create a new windows (xp) service that runs a jar file
> Does anyone has experience/know how to create a new windows (xp)
> service that runs a jar file? This issue rises as i need to hide the
> most of the java implementation in this project before it goes live.
Use the "Java Service Wrapper"
http://wrapper.tanukisoftware.org/doc/english/introduction.html#service
Bye.
--
Real Gagnon from Quebec, Canada
* Looking for Java or PB code examples ? Visit Real's How-to
* http://www.rgagnon.com/howto.html
|
| |
|
| |
 |
JPractitioner

|
Posted: 2006-7-7 21:45:00 |
Top |
java-programmer >> create a new windows (xp) service that runs a jar file
thx to the both of u.
i really appreciate..
good luck and all the best!
Real Gagnon wrote:
> > Does anyone has experience/know how to create a new windows (xp)
> > service that runs a jar file? This issue rises as i need to hide the
> > most of the java implementation in this project before it goes live.
>
> Use the "Java Service Wrapper"
>
> http://wrapper.tanukisoftware.org/doc/english/introduction.html#service
>
> Bye.
> --
> Real Gagnon from Quebec, Canada
> * Looking for Java or PB code examples ? Visit Real's How-to
> * http://www.rgagnon.com/howto.html
|
| |
|
| |
 |
JPractitioner

|
Posted: 2006-7-20 18:41:00 |
Top |
java-programmer >> create a new windows (xp) service that runs a jar file
Hi Daniel, I followed your way.
I just dont know how to start with java service wrapper. realgagnon
might have some idea on this that he can share with us?
So back to the topic, I managed to add a new service on my pc and it
shows in my services applet. But the service cannot run a jar file, it
throws error that says the service has been stopped because it is
inactive. Actually the program is active. It listens to client's
requests once started. It takes some configuration value from a few
files.
Anyway, i figured out that, windows might expect an exe instead of jar
to execute. So i tried to convert the jar to exe. I did that and the
exe can run. Following that, I edit my registry.. pointing the value
data to the exe i made.
I try again, this time i can see my program's console for a while and
then my program throws error saying that it cannot get the file as if
the file was not even there.
This is weird since i can run the program perfectley with the jar and
the exe but when it involves windows service to run the exe, the file
not found error slap me right on my face.
So, dsjoblom.. /other readers, do u have any idea why this happened and
how i can solve this?
Thinking of other alternatives, I will just copy a shortcut to my
startup folder, but this wont do very well since someone (administrator
in my case) has to log on before the system can run. The administrator
account will have to log on forever... or I might have to consider
another user account dedicated to this thing hmmmm......
ok guys, thanks.
email***@***.com wrote:
> JPractitioner wrote:
> > Hello guys,
> >
> > Does anyone has experience/know how to create a new windows (xp)
> > service that runs a jar file? This issue rises as i need to hide the
> > most of the java implementation in this project before it goes live.
> >
> > So the idea is, to have control on the exceution of the jar from
> > windows windows service console (which the users can define the startup
> > type i.e. manual, automatic, disabled and the running life cycle i.e.
> > start, stop, pause, resume, restart...).
> >
> > so any leads to solving this will be appreciated.
> >
> > Thanks in advance. Have a nice day!
>
> I imagine you would create it like any other windows service. See
> http://support.microsoft.com/kb/q137890/
>
> Regards,
> Daniel Sj鯾lom
|
| |
|
| |
 |
JPractitioner

|
Posted: 2006-7-20 18:46:00 |
Top |
java-programmer >> create a new windows (xp) service that runs a jar file
guys, when i meant "files".. they are the configuration files that feed
the configuration value such as remote address and so on...
JPractitioner wrote:
> Hi Daniel, I followed your way.
> I just dont know how to start with java service wrapper. realgagnon
> might have some idea on this that he can share with us?
>
> So back to the topic, I managed to add a new service on my pc and it
> shows in my services applet. But the service cannot run a jar file, it
> throws error that says the service has been stopped because it is
> inactive. Actually the program is active. It listens to client's
> requests once started. It takes some configuration value from a few
> files.
>
> Anyway, i figured out that, windows might expect an exe instead of jar
> to execute. So i tried to convert the jar to exe. I did that and the
> exe can run. Following that, I edit my registry.. pointing the value
> data to the exe i made.
>
> I try again, this time i can see my program's console for a while and
> then my program throws error saying that it cannot get the file as if
> the file was not even there.
>
> This is weird since i can run the program perfectley with the jar and
> the exe but when it involves windows service to run the exe, the file
> not found error slap me right on my face.
>
> So, dsjoblom.. /other readers, do u have any idea why this happened and
> how i can solve this?
>
> Thinking of other alternatives, I will just copy a shortcut to my
> startup folder, but this wont do very well since someone (administrator
> in my case) has to log on before the system can run. The administrator
> account will have to log on forever... or I might have to consider
> another user account dedicated to this thing hmmmm......
>
> ok guys, thanks.
>
> email***@***.com wrote:
> > JPractitioner wrote:
> > > Hello guys,
> > >
> > > Does anyone has experience/know how to create a new windows (xp)
> > > service that runs a jar file? This issue rises as i need to hide the
> > > most of the java implementation in this project before it goes live.
> > >
> > > So the idea is, to have control on the exceution of the jar from
> > > windows windows service console (which the users can define the startup
> > > type i.e. manual, automatic, disabled and the running life cycle i.e.
> > > start, stop, pause, resume, restart...).
> > >
> > > so any leads to solving this will be appreciated.
> > >
> > > Thanks in advance. Have a nice day!
> >
> > I imagine you would create it like any other windows service. See
> > http://support.microsoft.com/kb/q137890/
> >
> > Regards,
> > Daniel Sj鯾lom
|
| |
|
| |
 |
bowman

|
Posted: 2006-7-20 21:50:00 |
Top |
java-programmer >> create a new windows (xp) service that runs a jar file
JPractitioner wrote:
> I try again, this time i can see my program's console for a while and
> then my program throws error saying that it cannot get the file as if
> the file was not even there.
Where is it looking for the file? Services inherit from the SCManager and
often act as if the cwd is %WINDIR%\system32. I am not familiar with the
Java wrapper and don't know what tweaking it might do as the process is
spun up by the SCManager. If you are using a relative path, try an
absolute.
As a service is started, The SCManager expects feedback from the new thread
on a timely basis saying "I'm still trying to get it together", "I'm good
to go", and so forth and assumes it is not running if the reply isn't
received, but the wrapper should be taking care of this housekeeping.
----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
|
| |
|
| |
 |
Luc The Perverse

|
Posted: 2006-7-20 21:58:00 |
Top |
java-programmer >> create a new windows (xp) service that runs a jar file
"JPractitioner" <email***@***.com> wrote in message
news:email***@***.com...
> Hello guys,
>
> Does anyone has experience/know how to create a new windows (xp)
> service that runs a jar file? This issue rises as i need to hide the
> most of the java implementation in this project before it goes live.
>
> So the idea is, to have control on the exceution of the jar from
> windows windows service console (which the users can define the startup
> type i.e. manual, automatic, disabled and the running life cycle i.e.
> start, stop, pause, resume, restart...).
>
> so any leads to solving this will be appreciated.
>
> Thanks in advance. Have a nice day!
>
If you really need to run a Java program as a Windows Service you might want
to natively compile it.
I know excelsior Jet professional has a windows service native compilation
option.
(I think Jet is the only byte code to windows code converter that is still
around and up to date.) There is a GNU byte code to Linux binary compiler.
:)
|
| |
|
| |
 |
JPractitioner

|
Posted: 2006-7-20 23:29:00 |
Top |
java-programmer >> create a new windows (xp) service that runs a jar file
Hi bowman,
After i read your comment, i realized that those file were refered
relatively. So i changed them to an absolute path. and it
<b>WORKS!!!!!</b>
thanks man for teaching me this.
however, some xml files were also out of reach.. and the error said
that the xml cant be found in c:\windows\system32
so i place the xml files there, and its working.
I have one more question.. why is that when i stop the service, only
srvany.exe being killed.. but my app still alive? and also if i kill my
app, the srvany.exe still alive.. why is it like this?
Again, thanks a lot bowman, the tips u gave is the key that i will use
to learn more about windows.
Thanks,
Makmur.
bowman wrote:
> JPractitioner wrote:
>
> > I try again, this time i can see my program's console for a while and
> > then my program throws error saying that it cannot get the file as if
> > the file was not even there.
>
> Where is it looking for the file? Services inherit from the SCManager and
> often act as if the cwd is %WINDIR%\system32. I am not familiar with the
> Java wrapper and don't know what tweaking it might do as the process is
> spun up by the SCManager. If you are using a relative path, try an
> absolute.
>
> As a service is started, The SCManager expects feedback from the new thread
> on a timely basis saying "I'm still trying to get it together", "I'm good
> to go", and so forth and assumes it is not running if the reply isn't
> received, but the wrapper should be taking care of this housekeeping.
>
>
>
>
> ----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
> http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
> ----= East and West-Coast Server Farms - Total Privacy via Encryption =----
|
| |
|
| |
 |
JPractitioner

|
Posted: 2006-7-20 23:31:00 |
Top |
java-programmer >> create a new windows (xp) service that runs a jar file
Thanks Luc, I'll take a look of this software,,
Luc The Perverse wrote:
> I know excelsior Jet professional has a windows service native compilation
> option.
>
|
| |
|
| |
 |
bowman

|
Posted: 2006-7-21 12:17:00 |
Top |
java-programmer >> create a new windows (xp) service that runs a jar file
JPractitioner wrote:
> I have one more question.. why 聽is that when i stop the service, only
> srvany.exe being killed.. but my app still alive? and also if i kill my
> app, the srvany.exe still alive.. why is it like this?
I don't use srvany so I am not positive, but I do not think srvany
implements the stop event. In C/C++, you add code to the application. The
SCManager calls that as main(), which sets up the dispatcher, usually
ServiceMain() by convention. That threads off the real application, and
also registers a callback with the SCManager.
When the dispatch thread receives a stop event from the SCManager, it
reports back that it is stopping the application, does something to make
that happen, reports when it is stopped. I believe srvany spins up the
application, and after that it's on its own. It is meant to be a quick and
dirty way to make something into a service when you don't have source.
It isn't necessary, but I usually play a few games in the code to get the
process's cwd back to where it really is so I don't clutter up
%WINDIR%\system32, but afaik srvany doesn't do this. Also, if things are
set up so the application will drop a core if things go bad, that usually
is in system32, too.
You can do a lot of interesting things with services in C, but I have no
idea how you would do it in Java, except maybe JNI magic.
----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
|
| |
|
| |
 |
Steve Sobol

|
Posted: 2006-7-21 15:21:00 |
Top |
java-programmer >> create a new windows (xp) service that runs a jar file
bowman wrote:
> You can do a lot of interesting things with services in C, but I have no
> idea how you would do it in Java, except maybe JNI magic.
http://wrapper.tanukisoftware.org
and there are a couple other similar products.
--
Steve Sobol, Professional Geek ** Java/VB/VC/PHP/Perl ** Linux/*BSD/Windows
Apple Valley, California PGP:0xE3AE35ED
It's all fun and games until someone starts a bonfire in the living room.
|
| |
|
| |
 |
JPractitioner

|
Posted: 2006-7-21 15:54:00 |
Top |
java-programmer >> create a new windows (xp) service that runs a jar file
i see.. so srvany is not the best way eh.
bowman, seems like u are really into windows programming. I had some
very basic knowledge with C/C++. I suppose to call ServiceMain(), i
will have to include some header files, probably C headers. Can u tell
me whats the header file i will have to use?
Yeah i will use JNI with C headers. By the way, converting the JAR to
EXE involves JNI. So i'll use the the headers appropriately with JNI to
explore deeper on controlling native threads.
Before this, I also tried to make the srvany to run a batch file that
will call the jar file. Just wont work. Windows services only run exe
files i guess.
Thanks for your comments.
bowman wrote:
> JPractitioner wrote:
>
> > I have one more question.. why is that when i stop the service, only
> > srvany.exe being killed.. but my app still alive? and also if i kill my
> > app, the srvany.exe still alive.. why is it like this?
>
> I don't use srvany so I am not positive, but I do not think srvany
> implements the stop event. In C/C++, you add code to the application. The
> SCManager calls that as main(), which sets up the dispatcher, usually
> ServiceMain() by convention. That threads off the real application, and
> also registers a callback with the SCManager.
>
> When the dispatch thread receives a stop event from the SCManager, it
> reports back that it is stopping the application, does something to make
> that happen, reports when it is stopped. I believe srvany spins up the
> application, and after that it's on its own. It is meant to be a quick and
> dirty way to make something into a service when you don't have source.
>
> It isn't necessary, but I usually play a few games in the code to get the
> process's cwd back to where it really is so I don't clutter up
> %WINDIR%\system32, but afaik srvany doesn't do this. Also, if things are
> set up so the application will drop a core if things go bad, that usually
> is in system32, too.
>
> You can do a lot of interesting things with services in C, but I have no
> idea how you would do it in Java, except maybe JNI magic.
>
>
>
>
>
> ----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
> http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
> ----= East and West-Coast Server Farms - Total Privacy via Encryption =----
|
| |
|
| |
 |
bowman

|
Posted: 2006-7-21 22:16:00 |
Top |
java-programmer >> create a new windows (xp) service that runs a jar file
JPractitioner wrote:
> I suppose to call ServiceMain(), i
> will have to include some header files, probably C headers. Can u tell
> me whats the header file i will have to use?
It is declared in Winsvc.h, but you would probably have to start with
Windows.h which may cause problems. I don't suppose you have DevStudio and
the MSDN docs. It documents the StartServiceCtrlDispatcher,
RegisterServiceCtrlHandler, SetServiceStatus, and all the other hoops you
have to jump through. Lacking that, there should be an example someplace on
the 'net; it's pretty much boilerplate code.
----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
|
| |
|
| |
 |
bowman

|
Posted: 2006-7-21 22:24:00 |
Top |
java-programmer >> create a new windows (xp) service that runs a jar file
Steve Sobol wrote:
> http://wrapper.tanukisoftware.org
Looks pretty handy, especially the third method. Often an application
running as a service should do some atexit cleanup and shutdown gracefully
rather than get chopped off at the knees with a ^C.
----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
|
| |
|
| |
 |
JPractitioner

|
Posted: 2006-7-22 0:57:00 |
Top |
java-programmer >> create a new windows (xp) service that runs a jar file
Thanks a lot bowman =)
bowman wrote:
> JPractitioner wrote:
>
> > I suppose to call ServiceMain(), i
> > will have to include some header files, probably C headers. Can u tell
> > me whats the header file i will have to use?
>
> It is declared in Winsvc.h, but you would probably have to start with
> Windows.h which may cause problems. I don't suppose you have DevStudio and
> the MSDN docs. It documents the StartServiceCtrlDispatcher,
> RegisterServiceCtrlHandler, SetServiceStatus, and all the other hoops you
> have to jump through. Lacking that, there should be an example someplace on
> the 'net; it's pretty much boilerplate code.
>
> ----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
> http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
> ----= East and West-Coast Server Farms - Total Privacy via Encryption =----
|
| |
|
| |
 |
| |
 |
Index ‹ java-programmer |
- Next
- 1
- jboss 4.0.3 jboss portal 2.2.1hi
i am a one week newbie to j2ee world ( no java exp )
however i am to deploy application ( that is compiere ) onto existing
platform ( pentaho that is )
as per this date my assumptions are :
= point of integration would be in portal
= compiere application itself, war, would be deployed on jboss /deploy
= jsp be made to enable access from portal to war
could somebody help me on what is the definable steps to do the
integration?
- 2
- Convert from text string "Hello" to floating-point number issueHi there,
My java lecturer has given us an assignment related to casting and
type conversion etc.
One of the conversions he wan't is convert "Hello" to a float.
I suspect this is a trick question on his part as "Hello" is not a
parsible value.
This is the code I have:
//Convert String object "s" to a Float object
//then convert Float object to float value
try { System.out.println("String is "+s+" float is
"+Float.valueOf(s).floatValue());
}
catch (NumberFormatException NFE)
{ System.out.println("NumberFormatException: "+ NFE.getMessage()+
" The input string does not contain a parsable number"); }
I emailed the guy but he says just to use your own judgement.
I looked at the API for the wrapper classes etc and I think a
conversion of this type is almost impossible.
Any ideas welcome.
- 3
- Toward a generic Disk Sort for JavaI was thinking how you might go about writing a sort that could handle
more data than could fit in RAM. It handled the problem is Abundance
by checkpointing the app to disk to free up maximum RAM, then spawning
a copy of Opt-Tech sort. My records were roughly like DataOutputStream
would produce, so I could automatically generate the command script
sort the fields in any way I wanted.
I thought you might pull it off in Java this way.
1. You write a comparator as if you were going to sort Objects in an
ArrayList.
2. the external sort has an add method that also takes collections.
It accepts a "chunk" of records, and sorts them using Sun's sort.
Then it writes them out as SERIALISED objects in heavily buffered
stream. There may be some way to do a partial reset after each object
to speed it up.
Then you repeat collecting, sorting and writing another batch to
another file.
When you have created N files, you recycle, appending. (Optimal N to
be determined by experiment). Ideally each file would be on a
different physical drive.
Then when all the records have been added, you start merging chunks
into longer chunks, and writing out the longer chunks. Each N-way
merge cuts the number of chunks by 1/N and increases the length of the
chunks N times.
on the final merge pass does not happen until the user invokes the
Iterator to hand over the resulting records.
Another way it might be done is the records to be sorted must by byte
arrays, chunks effectively produced by DataOutputStream. You specify
offset, length and key type e.g.
int, byte, short, float, double, String.
This would require a detailed knowledge of the bit structure of the
records, the way you did in the olden days of assembler and C.
This would be clumsier to use, but would avoid the overhead of
pickling and reconstituting records on every pass.
Then of course, there is the possibility someone has already solved
this and done it well.
The universe has a sneaky habit. Problems start out small, and it
looks like a purely in RAM solution is perfectly adequate. Then they
bit by bit grow and grow and start pushing the limits of the RAM
solution. Suddenly you are faced with a major redesign.
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
- 4
- Generics and returning specific subclass from methodI have an abstract class called say Base and two subclasses, say Sub1 and
Sub2. Let me define a method in Super which I want to return a new instance
of the superclass itself but I want to access this without having to cast.
IE,
public class Super {
public <E extends Super> E partialCopy() {
return this; // return this for example
}
}
public class Sub1 extends Super { }
Then I want to do this without the cast.
Sub1 s1 = new Sub1();
Sub2 s2 = s1.partialCopy();
Can I do this with generics ?
- 5
- Vmx Smalltalk for JavaA Beta version of Vmx Smalltalk for Java is now available for download.
http://vmx-net.com/downloads/downloadjvm.php
Your comments are welcome,
email***@***.com
- 6
- JRE installation woesHi All
I have installed the latest version of Sun's JRE on my Windows XP Pro PC.
However, its "performance" is somewhere between abysmally slow and not at
all. If I e.g. open the Java Control Panel module and click on one of the
tabs, it takes over two minutes for that tab to display - this on a 3.4 GHz
dual-processor 4 GB memory PC. Java aplications run no better. It does seem
to "speed up" if I Alt-tab to another program and then Alt-tab back.
CPU load is negligible so clearly, the JRE is waiting for something that
occurs only rarely. But I have no idea where to look.
Any help will be very much appreciated.
Ebbe
- 7
- Sun Wireless Toolkit gives SecurityException - please help.I have a midlet (not written by me), and I would like to analyze how it
works. Unfortunately I am not able to run this midlet. Everything compiles
fine but I receive an runtime exception during running sun WTK emulator.
Incorrect domain name, switching to 'untrusted'
java.lang.SecurityException: untrusted domain is not configured
at com.sun.midp.security.Permissions.forDomain(+98)
at com.sun.midp.dev.DevMIDletSuitImpl.create(+39)
at com.sun.midp.dev.DevMIDletSuitImpl.create(+62)
at com.sun.midp.main.Main.runLocalClass(+20)
at com.sun.midp.main.Main.main(+116)
Exception completed.
14945 bytecodes executed
0 thread switches
738 classes in the system (including system classes)
229 dynamic objects allocated (14588 bytes)
1 garbage collections (0 bytes coolected)
I am not able to fing any solution via google. I hav e found only some not
clear instruction to delete MIDP_HOME environment variable. But I have not
any MIDP_HOME on my system.
I have also found some advices to change something in
java.security and java.policy files.
Unforunately I don't know what to change. Anyone has any idea how to fix my
problem ??
I will be appreciate for any advice. Thanks in advance.
--
RaW
Please fill free to correct my English.
- 8
- AbstractTableModel not compatible with SwingWhat happens when AbstractTableModel is no longer compatible with Swing?
I kinda see how to use it, but don't see how XMLEncoder would work in its
place.
"Warning: Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is appropriate
for short term storage or RMI between applications running the same
version of Swing. As of 1.4, support for long term storage of all
JavaBeansTM has been added to the java.beans package. Please see
XMLEncoder. "
http://java.sun.com/javase/6/docs/api/javax/swing/table/
AbstractTableModel.html
thanks,
Thufir
- 9
- StreamCorruptedExceptionHi
sorry my english is not very good [:())
i have something like that:
Socket------------------------------------------------class1------ObjectOutp
utStream
|
|
|
inner class in class1-thread-ObjectInputSt.
|
-----------------class2
| |
| inner class in class2 thread ObjectInputStream,
ObjectOutputStream
|
|
|
--------class3- and here when i create ObjectOutputStream in inner class in
class1 in thread
jumps out exception StreamCorruptedException
why?
please help
i don't know what i have should do?
Czeski
- 10
- Formatting a string in JavaHi
I am a newby in Java and am trying to format a string into a fixed
number of positions( in this case 5).
So if I have a "5" in should be "00005", and "23" should be "00023".
I hav tried looking at the classes 'import java.text.NumberFormat' and
'import java.text.Format', but I didn't get far.
Can anyone help me how I can do this in java?
Any help will be appreciated.
Regards
- 11
- Exec() Help!Hi,
I'm trying to start an external applet from an applet I'm writing. I know
Exec() Is the key, but I don't know how to use it. I know how to execute
external native programs (I.e. programs I have written in BASIC and
compiled). But starting an applet from an applet totally throws me. I have
tried searching the net, and that has a lot to say about executing shell
scripts, and natives - which I know how to do.
What classes do I need to import? what line of code invokes an external
applet? I don't need to grab output from the applet I want to execute, or
send input. I just want it to run.
Pleeeeeeez can anyone help, my project has to be handed in soon :-(
Thanks,
Dafydd.
- 12
- instanceOf operator new bie questionI am using Java 1.4.2.x
I wrote following code:
NumberFormat df;
df = NumberFormat.getInstance();
if (df instanceof DecimalFormat) {
((DecimalFormat) df).setMinimumIntegerDigits(1);
((DecimalFormat) df).setDecimalSeparatorAlwaysShown(true);
}
What does "df instanceof DecimalFormat" really mean? Does it mean that
NumberFormat can be converted to DecimalFormat? Because my
NumberFormat.getInstance() is returning me a NumberFormat and not
DecimalFormat what else could it mean.
I did read about instanceOf opeartor on google, but it is still
confusing to me.
Thanks a lot.
Prem
- 13
- J2MEHello,
Are there any newsgroups or forums specifically for J2ME? I would like to
make a game for mobile devices but I don't know where to start.
Thanks in advance,
Steve
- 14
- Bug in java.net.Socket close() behavior?According to the API for java.net.Socket close():
"Any thread currently blocked in an I/O operation upon this socket
will throw a SocketException."
http://java.sun.com/j2se/1.5.0/docs/api/java/net/Socket.html#close()
I have observed that java 1.5 on FreeBSD does not follow this while
the Windows and Linux ones I have tested do. On the FreeBSD runtimes
that I have tested, a thread blocked on reading a socket just hangs
forever if the socket is closed.
Attached is a simple program that tests this behavior. It just
connects to a port on one of my servers and has a reader thread
watching input from the socket and closes the socket in a different
thread to see if the reader thread gets an exception.
Java runtimes that I have tested this on:
# java -version
java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build diablo-1.5.0-b01)
Java HotSpot(TM) 64-Bit Server VM (build diablo-1.5.0_07-b01, mixed mode)
# java -version
java version "1.5.0-p2"
Java(TM) 2 Runtime Environment, Standard Edition (build
1.5.0-p2-root_07_mar_2006_02_41)
Java HotSpot(TM) 64-Bit Server VM (build
1.5.0-p2-root_07_mar_2006_02_41, mixed mode)
- 15
|
|
|