Using Scanner within Java Program
How do i call a scanner (scan documents) from a java application and collect the output from scanner in java application.
Hi,
You can try a package named: JTwain, which is available at http://asprise.com/product/jtwain.
JTwain supports all kinds of digital cameras and scanners. You can use Java to access, contorl digital cameras and scanners, and of course, to acquire images with flexible settings.
The developers' guide is available @ http://asprise.com/product/jtwain/devGuide.php
In the simplest case, one line of Java code can solve your problem.
Good luck!
Similar Messages
-
How can I use MS Word within java programming
Hi everyone!
I am developing a Java program that will take data
from an Access 2000 database, and manipulate it,
display the results graphically and in tables. The
challenge for me is that I want the program insert the
graphics and tables into the MS Word template and then
prompt me to save it as a word * .doc. Do you know
of any articles or sources of sample code on how to do
this. The Java environment is Java2, JDK 1.3,
JBuilder4. The OS environment is XP.
Regards,
FaradHi, I also need that package. my e-mail is [email protected] Plese send me that. Thanks in advance
I have a package that will do this for you. I just
need to get your email to send an attachment and
examples. -
How would i do to run scanner within java??
i have to make a button within java
clicking the button can start scanner
run scanner UI!
i find many books!
but i don't know what to do
do everybody have some program about that??
thx...Hi,
You can try a package named: JTwain, which is available at http://asprise.com/product/jtwain.
JTwain supports all kinds of digital cameras and scanners. You can use Java to access, contorl digital cameras and scanners, and of course, to acquire images with flexible settings.
The developers' guide is available @ http://asprise.com/product/jtwain/devGuide.php
In the simplest case, one line of Java code can solve your problem.
Good luck! -
Antcall causes FileNotFoundException if using executeTarget within java
Hi all,
this is my first post here, so i dont know if it's the right place (sorry if so).
I try to run an ant target within a java program.
My build file (test.xml) is:
<project name="test" default="usage" basedir=".">
<target name="test1" >
<echo message="Target test1" />
<antcall target="test2"/>
</target>
<target name="test2" >
<echo message="Target test2" />
</target>
</project>My java programm is:
public static void main (String [] a) {
String buildFileName = "test.xml";
File buildFile = new File (".",buildFileName);
Project project = new Project();
project.init();
ProjectHelper helper = new ProjectHelperImpl();
helper.parse(project, buildFile);
project.executeTarget("test1");
}This causes following exception:
Exception in thread "main" test.xml:4: The following error occurred while executing this line:
java.io.FileNotFoundException: build.xml
at org.apache.tools.ant.ProjectHelper.addLocationToBuildException(ProjectHelper.java:539)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:336)
at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:107)
at org.apache.tools.ant.Task.perform(Task.java:364)
at org.apache.tools.ant.Target.execute(Target.java:341)
at org.apache.tools.ant.Target.performTasks(Target.java:369)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
at test.Test.main(Test.java:19)
Caused by: java.io.FileNotFoundException: build.xml
at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:243)
at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:140)
at org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.java:91)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:334)
... 7 more
Caused by: java.io.FileNotFoundException: build.xml
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:106)
at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:198)
... 10 moreIf I use <ant antfile="test.xml" target="test2"/> instead it works perfecly. But I don't want to. The target "antcall" was created to call targets within the same build-file, but why build.xml is referenced anywhere?
Might this be an ant bug?
Any ideas?
TxDisregard, sorry, got confused about build.xml and text.xml.
May I advise to ask at an Ant forum, though? -
Why an Interface is used in a Java Program
Since we have Classes in Java program
Then what is the need for An Interface in a Java Program
Please explain to me
i'm confusedThese are fair comments as per as interface is concern.... we need interface to declare the methods without implementing the methods. Basically interfaces help implementing classes in a organised way.
Now We got abstract class also, which has got more or less same features like interfaces. In abstract class also we can declare a method without implementation.
If we use abstract class and extend that abstract class, we don't have implement all the abstract methods in that particular class,which would extend the abstract class, but if we implement an interface in a class, we have to define all the methods with their body. Now, can anyone tell me , in a generic way, when do we use interface and when do we use abstract class. I don't need the differences between abstract class and interface...that i know...thanks in advance
take it easy
RD
l -
What do you use to write Java programs?
Hi. Do you mind if I ask you what do you use to write your programs in Java? I am a student and we are using NetBeans IDE 3.6. I know it is a bit old but the tutor says we must stick to that one. What is best for writing Java programs?
Thanks.Do you think those things will make things easier or is it more complex?If you're learning on your own, you'd better use something more up to date (most probably better interface, childhood bugs fixed, and better support on the Internet).
If you're in a classroom, or a training room, you'd better use what the instructor tells, or at least what other students/trainees use. Easier to get help and share tips if everyone has the same setup.
Good luck learning Java. -
How to use wsimport in java program
Hi friends,
wsimport is an external tool that parses wsdl and generates java artifacts.
Is there any way to use, invoke wsimport in a java program to parse wsdl and generate java artifacts ?
Is there any wsimport API that gives same parsing functionality as wsimport tool, so that I can use it in my java program? I searched but I didn't get that's why I need to post here
Thanks
HarshitYou may be able to call WsImport's main() method from your code, something like this:
import com.sun.tools.ws.WsImport;
String[] args = {"put", "your", "arguments", "here"};
WsImport.main(args);(Make sure that the webservices-tools.jar file is on the classpath, since that's the one containing the WsImport.class file - you'll probably need the other webservices jars too). -
Why using JDeveloper runing java program is faster
I have written a java program by JDeveloper 3.0, press run button to run the java check
the performance.
and then close JDeveloper, try to run the java program only on NT workstation.
I found that the performance is lower than
running inside JDeveloper.
Why the reason ?<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Rob (JDeveloper Team):
If you are running under JDK 1.2, then the reason is that internally JDeveloper uses the OJVM (Oracle Java VM) which is faster than most other JVM's on NT. You may wish to try your app with the JDK 1.3 rc2 from the Javasoft website (which uses HotSpot) and will be faster than the stock JDK 1.2.
<HR></BLOCKQUOTE>
Is compatiable using SQLJ for HotSpot ?
and if not using HotSpot
Can I uses OJVM only to run my program ?
How to do ?
Thank you
null -
Running ssh from within java program
Hi!
I am trying to start ssh from within java e.g.:
Runtime run = Runtime.getRuntime();
Process pro = run.exec("ssh -l xx 12.12.12.12");
But it complains:
socket: Operation not permitted
ssh: connect to host 12.12.12.12 port 22: Operation not permitted
Running ssh from the command prompt works just fine. It's run on win xp.
What is the problem, and how can I avoid it?
EndreAfraid not. I think maybe it's related to security permissions, but I am really not sure. If you can help, I would appreciate it.
- Endre -
Use plsql within java (or javascript) programs
hi,
to interface with oracle db, I've always used PLSQL blocks within programs written in C language but now I've to insert PLSQL blocks in java or javascript language
I don't know if it's possibile and I don't know how to do it
may someone explicate it to me?
thanks a lot!mfran2002 wrote:
hi,
to interface with oracle db, I've always used PLSQL blocks within programs written in C language but now I've to insert PLSQL blocks in java or javascript language
I don't know if it's possibile and I don't know how to do it
may someone explicate it to me?
thanks a lot!There is no pre-processor in the Java standard packages (don't know if there is one out there somewhere, but I imagine that there probably is) as there is for Pro*C. Oracle have one in store??? ... hope so.
So in Java the SQL (including function calls) is built as Strings, which are then fed as arguments to the execute methods of Statement, or to the PreparedStatement itself - that tutorial will spell this all out well.
So the SQLs can be static or build dynamically.
~Bill
Also ... you can store Java stored procedures in the Oracle DB, wrapped as PL/SQL functions and then call them as such. -
Sending command to OS within Java Program
How come I get:
java.io.IOException: CreateProcess: c:\autexec.bat c:\xx.bat error=2
when executing:
public class test
public static void main(String args[])
System.out.println("This is a test.");
Runtime rt = Runtime.getRuntime();
String onecmd = new String ("c:\\autexec.bat c:\\xx.bat");
try
rt.exec( onecmd );
catch (Exception e )
System.out.println( e );
And actually this is a test on Win NT, my final code will execute a command on a Sun using Solaris OS.
Thanks,
GeorgeFirst of all, I don't reccomend this:
String onecmd = new String ("c:\\autexec.batxec.bat c:\\xx.bat");When creating Strings I believe that it is better to assign them at creation than to use new to create them. like this:
String onecmd = "Hola!";Second, Yout know that in unix the command will be different. It should look like this sh /home/you/xx.sh
and I don't see why it would'nt work if you use
try {
String shCmd = "sh /home/me/me.sh";
Process p = Runtime.getRuntime().exec(shCmd);
/* I'm not sure if the next method is exact syntax */
p.waitFor();
}catch(Exception e) { }unless it is a windows problem. Are you sure you have permission to read and execute the two programs? -
Executing an HTML file within java program
I want my java code to be able to open/execute an HTML file that I have. How do you do this?
Thanks.You can display html in a java app, but it is not so simple to run a browser. What you want to look up is the WebBrowser class. Here is an excerpt from some code of mine that displays a url in the browser app in a panel, but there's some chaff in my code you would not be interested in (I'm using a card layout). You're better off loocing up org.jdesktop.jdic.browser which contains the WebBrowser class /**
* Reveal the container with the browser display. The browser display is
* currently hidded using a CardLayout, so it is a simple matter to swap
* displays; however, we put off actually loading the web page until the
* first time the display is revealed.
* @return true if the URL could be resolved and the given web page
* displayed.
public boolean showBrowser(
java.net.URL pURL )
// See if the web page component has not initialized.
if ( pWebBrowser == null )
pWebBrowser = new WebBrowser();
pBrowserPane.setViewportView( pWebBrowser );
if ( aLastURLVisited == null || ! aLastURLVisited.equals( pURL ) )
pWebBrowser.refresh();
pWebBrowser.setURL( pURL );
aLastURLVisited = pURL;
pDualLayout.show( pDualPanel, BROWSER_PANEL );
return true;
} -
Using Numbers with JAVA Programming
I'm about to fail JAVA and require expert solution to this problem:
When you take the year of the birth of Bill Clinton and add to it the year he took office plus his age at his last birthday, and then subtract the number of full years he has been in office, you get the number 3986 (or 3985 depending on the time of year in which you calculate). But when you add and subtract the similar figures for the leaders of Britain, and France, you get 3986 (or 3985) in each case! How can I solve this problem! Please help!I'm about to fail JAVA and require expert solution to
this problem:
When you take the year of the birth of Bill Clinton
and add to it the year he took office plus his age at
his last birthday, and then subtract the number of
full years he has been in office, you get the number
3986 (or 3985 depending on the time of year in which
you calculate). But when you add and subtract the
similar figures for the leaders of Britain, and
France, you get 3986 (or 3985) in each case! How can
I solve this problem! Please help!
hehehe...you are a silly person... -
Using WD APIs in Java Programming
Hi,
First let me explain my scenario:
I have to get the <b>attachments in a PDF document</b>, using a <b>java program</b>. I am using Java perspective of NWDS. I am using the APIs
->IWDPDFDocumentHandler
->IWDPDFDocumentAccessibleContext
->IWDPDFDocument
->IWDPDFDocumentAttachment
in my program.
When I run my java program, I am getting the <b>java.lang.NoClassDefFoundError</b>. Can you please, give me a solution for this problem?
Note : I have added the necessary JAR files to the project.
Thanks,
Prabhakar.Hi Sumit,
Here is the result which I got in the console,
java.lang.NoClassDefFoundError: com/sap/tc/webdynpro/services/exceptions/WDRuntimeException
at PDFAttachment.readAttachmentFromPDF(PDFAttachment.java:241)
at PDFAttachmentMain.main(PDFAttachmentMain.java:21)
Exception in thread "main"
Note :
PDFAttachment
- Class
readAttachmentFromPDF
- method
The code is,
String PDFDocName = "podetailswithAttachment.pdf";
//wdComponentAPI.getMessageManager().reportSuccess("Outside try FileName :"+PDFDocName );
try
//wdComponentAPI.getMessageManager().reportSuccess("Inside try FileName :"+PDFDocName );
FileInputStream fileInpStrm = new FileInputStream("C:\"+PDFDocName);
FileOutputStream fileOutStrm;// = new FileOutputStream()
ByteArrayOutputStream bo = new ByteArrayOutputStream();
int c;
while ((c = fileInpStrm.read()) > -1)
bo.write(c);
byte[] pdfSource = bo.toByteArray();
// Line :240
IWDPDFDocumentHandler pdfdocHandler =WDPDFDocumentFactory.getDocumentHandler();
IWDPDFDocumentAccessibleContext pdfdocaccContext = pdfdocHandler.getDocumentAccessibleContext();
pdfdocaccContext.setPDF(bo);
IWDPDFDocument pdfDocument = pdfdocaccContext.execute();
IWDPDFDocumentAttachment[] pdfatt = pdfDocument.getAllAttachments();
//wdComponentAPI.getMessageManager().reportSuccess("Length of the attachments: "+pdfatt.length);
//pdfdocaccContext.setPDF();
catch(Exception e)
//wdComponentAPI.getMessageManager().reportSuccess(""+e);
System.out.println(""+e);
Thanks,
Prabhakar. -
How Can One use XML data into our Java Program
I have an Java Program and an XML file contaning data. I want to parse the xml data and use into my Java Program. How can I do so.
Check out the org.xml.sax.XMLReader class.
Maybe you are looking for
-
How do you fix multiple calendars from appearing after iCloud sync?
After setting up iCloud and syncing my iPhone with it my iCal events are showing double in my iPhone (as in two events per entry). Does anyone know how to fix this?
-
No DV Capture with Premiere Elements 13? How do I downgrade to 12?
I have hours of footage to capture from a DV camcorder. I previously was using version 10 and was all excited when I received version 13 for Christmas. To my dismay when hooking up my camcorder via firewire, and opening the software, there was no opt
-
I've gone through the Help list under "Unresponsive Script Errors": I don't have Webroot SpySweeper; I tried letting the scripts run longer (selecting "Continue") but they keep coming up; my errors come up all the time, not just on certain websites;
-
Payment terms 45 days from month end
Hi, Any one has configured the payment terms above. If yes, pelase let us know how to do the same. Thanks Aravind
-
How to uninstall microft mouse drivers.
I have a usb microsoft mouse and installed the magic trackpad. I'm using Lion as my OS. My trackpad is connect but does not work. I've uninstalled the microsoft intellipoint software, but that didn't resolve the problem. Any ideas?