Trying to figure out my way around Sphinx 4 (the CMU speech recognition engine in Java), I tried to use a demo included with the distribution by altering it to what I wanted it to do (the name of the demo is Aligner). I am running into problems and want to use jdb from the command line for debugging the same. I read the documentation given here, but it is limited and does not have a solution to my problem, which in brief is as follows:
I invoke jdb like so:
jdb Aligner (name of the main class of the project).
Set a breakpoint like so: stop at Aligner:33
The output I get (on the command line):
Deferring breakpoint Aligner:33.
It will be set after the class is loaded.
In the file demo.xml (which is the makefile equivalent for this Project),
javac debug=true is mentioned.
My questions:
1. Where should I invoke jdb from? Should it be invoked from anywhere in the entire sphinx directory or should I invoke it from the same directory as Aligner.java?
2. How can I use jdb with the jar for this project?
P.S: I know I can use Eclipse with this, but I am not sure I know how to do that. My first priority is to get this up and running.
P.P.S: I am a Java newbie and do not know much about the language. My preference for the command line comes from my background of C/C++ programming on the command line.
Any help is most welcome,
Thanks!
What are you actually trying to do?
If you are not so familiar with Java, why not use Sphinx3 or pocketsphinx, both of which are implemented in C?
http://cmusphinx.sourceforge.net/wiki/download/
Also, you might get better responses on this topic by checking the forums on the above site, or checking in to the IRC channel #cmusphinx
Finally, you mention that your program name is 'aligner', which makes it sound like maybe you are trying to do forced alignment? There are already existing tools for this in the sphinx3/sphinxtrain/pocketsphinx packages and it would probably be worth your while to check them out.
Related
Is there a way to just run individual java commands without having to create a file? Kind of like the matlab command window, where you can just type one line and it'll run.
Currently
No.
Java is not a terminal programming language like matlab and python.
To run java applications, the commands must be compiled
When you compile, the java compiler turns the code into a class file. The class file contains "instructions" for the computer which is the application.
To clarify, Java 9 has JShell, which is a REPL for java. You can find the early access here.
I think what you are looking for is something like this
https://blogs.oracle.com/java/jshell-and-repl-in-java-9
Sadly it isn't available until java 9, so in its current state it might not be production ready
try is here https://jdk9.java.net/download/
this shows you how to get it going
http://www.journaldev.com/9879/java9-install-and-repl-jshell-tutorial
Our java program is suppose to call a program created by our vendor in C#. We are given two files
1.An exe file
2.An xml file...which its contents go something like this
<doc>
<assembly><name>someProgram</name></assembly>
<members>
<member name="P:SomeConnector.callSomeOtherProgram()">
<summary>a method to connect to some program</summary>
<remarks></remarks>
</member>
</members>
</doc>
We're clueless on how to so this. Anyone got ideas?
for running comman line in java use:
Runtime rt = Runtime.getRuntime();
Process pr = rt.exec("MyOtherProg.exe progParameter1 progParameter2");
judging by your comment and question i think you have a class library, and the right way to approach this would be to just create your own C# program that calls the different method on that class library using the given xml as a program args or other way
Edit
your comment:
unning the exe manually (double click) shows up a wizard with an input
text field and some buttons which does different tasks. the idea is
for our java program to automatically run it and provide the fields
and execute which buttons we would like to trigger to do the function
we want. the java program just automates whatever is done manually
answer:
ok, now we're coking with fire :)
so, at this point i would go to the vendor and ask if i can get a class library instead of the current ui, as you want it running automatically, without Human intervention. while on it i would check if you got other .dll files with the program. if so investigate them using VS.
one last thing, if all is turn bad and you have to do clicks, it's not lost yet, but at this point you have a lot of work, and i can't help you from here, but i'll send you to a link to start what you need and you'll explore from there:
clicking robot
youtube video on the subject
I'm a noobie to Java and I had some questions, I think they may be easy (duh) answers to you experts but for me, I couldn't figure out the answer.
What is the point of Java programs, all I am making in my class now are simple read text files, have user input some stuff on the command line and the program prints out something. Like, it's cool and all that I can make a program do this but what does this all lead up to?
Say, I create a java program that converts celcius to fahrenheit and I want to have someone use it. Would I be able to get someone to use it that has no knowledge of Java, that is to say, giving it to my mom and she can run it from her computer without using Eclipse? How do I have someone who has no knowledge of coding run my program?
And my last question is, what is the point of command line arguments? Instead of putting them in the arguments, why not just have it in the code itself? Is it because if the code is big, it might be hard to find it? And if I download code that requires argument input, is it possible to download the code with the arguments set in Eclipse or would I have to manually do it?
Thanks, sorry for the long paragraph, but just wanted to put my thoughts down.
I think the short answer is modularity. Compiling or building a Java program takes time and knowledge (like you mentioned, someone who has no knowledge of Java probably wouldn't know what to do).
Passing in command line arguments allows you to just send someone the binary distribution of your program and passing in their own parameters without having to know what your code looks like or have to modify it.
In real life, programs aren't run from Eclipse (obviously), they're usually packaged into jars or wars and executed from the command line or some kind of app server.
If you download code that requires command line arguments, you will probably have to put them into Eclipse yourself, but hopefully the application has some documentation or help usage that explains what the arguments should look like.
You can create your own jar files that you can run from the console.
One of the simpliest ways to make your program usable without using Eclipse is with the Windows command prompt or Linux terminal:
go to you working directory (where your java file is stored)
Type javac (Example:javac hello.java) -This would compile your program
Type java (Example: java hello) - This will start it
Using of args is when you want to set some information to your program with the launching of the program.
Another way to start your program without using Eclipse is to make your own executable jar. With this you will get something like .exe file From which you can start your aplication
Most of the java programs are started from the CMD / terminal, or runs on java servers. There are aplication which have their own user interface (SWING, SWT, AWT ...) .
Most popular types of Java usage is creating a serious bussiness software, android aplications, complex web aplications etc.
what is the point of command line arguments?
Benefits of using Command line.
if I download code that requires argument input, is it possible to
download the code with the arguments set in Eclipse or would I have to
manually do it?
Right Click on project-name > Run > Run Configuration > select Arguments tab
For more info click here.
What is the point of Java programs, all I am making in my class now
are simple read text files, have user input some stuff on the command
line and the program prints out something. Like, it's cool and all
that I can make a program do this but what does this all lead up to?
This is just the begining. Learn Java core. Get familiarized with Java. One day you will be building tools using Java. eg:- Apache
How do I have someone who has no knowledge of coding run my program?
Compiling a java program into an executable
Before you do any this, get a book on Java (my fav - Java The Complete Reference) and read it. Learn how Java works, why is it different from other languages, best practices etc...
After 2-3 years from now, you'll get the importance of taking a small step by building simple cmd line programs using Java
I am writing/planning to write a program that takes in a java file (or multiple java files), and edits and adds functions/classes/variables and then outputs a new java file (or multiple files).
Is there a C++ or Java library that
Can recognize and output names of classes/functions within a text file
Can recognize and output the names of the input arguments for said classes/functions
Can allow me to insert code at specific lines or within specific functions
Can search for a given variable name/value
Maintains original file formatting
I would prefer not having to manually code something to do the above, so any help would be appreciated.
Thank you in advance!
EDIT: I currently use Eclipse, and am unsure of how to proceed. So to further explain my question:
In eclipse, if I write a program that opens another .java file, How would I go about 'asking' eclipse to output, say, all the class names of the .java file I just opened?
Also I will explain the 'purpose' of this project to further clarify. I want to write a program that can take in any java file, and turn it into a class that can implemented remotely via RMI. To do this I will need to add an execute() function, have the file implement Task and Serializable and add a few variables, etc... Based on my knowledge, doing this in Eclipse would require manual editing of the program, but I would like to completely automate this process.
Thank you, again.
Much of what you need can be found in a modern IDE; and some very good IDEs are open source (eclipse and Intellij IDEA Community Edition for Java). You might look there to see if there are modules that suite your needs.
Looks like you are talking of a tool like eclipse. You might not be looking for a full fledged IDE, but the requirements that you have mentioned are fulfilled by any basic IDE.
If you wish to make one of your own, you can do that using eclipse rich client platform.
All that you would need from Java is the reflection API.
I'm very new to all Java related programming. For a school assignment, I've created my Java application using BlueJ. Apparently, the application should be able to run from the command prompt with the following line:
myapp -compress fileName
Honestly, I don't have the slightest idea about how to setup such:
My application has a Main class. Am I supposed to change it to be called myapp?
I've been running my app with java Main compress filename. I see that now I shouldn't be using the java key. But of course, as it is now, it won't work if I remove it. How can I run the app without it?
Is there a difference between having the compress argument I always use and the -compress one they tell me? Is that dash (-) any special?
Looking at this page: http://docs.oracle.com/javase/1.4.2/docs/tooldocs/windows/java.html, it seems to insist that to run my program I do need to use the java key. And the dash seems to be used for something called options - there are standard and non-standard. However, there doesn't seem a way to make a "custom" one (-compress).
So my question is, how can I run my application with the above format?
The easiest way it to create a one-line shell script (if you're using Unix) or a one-line batch file (if you're using Windows). Call it myapp (or myapp.bat) and make it launch Java, passing the appropriate arguments.
As to the -compress argument, your main() takes an argv. You'll need to examine that to figure out what arguments have been passed to your program. You can either code everything yourself (very easy in your case), or use an existing framework:
How to parse command line arguments in Java?