Here is some promising thread ...
http://www.java-tips.org/java-se-tips/javax.sound/capturing-audio-with-java-sound-api.html
Here is some promising thread ...
http://www.java-tips.org/java-se-tips/javax.sound/capturing-audio-with-java-sound-api.html
you can use StringTokenizer class inorder to differentiate ip and port
you need to use JMF(java media framework) . Google jmf and you'll find it .
There are some third party softwares for making setup files which are available for free on web.
Just google it and you'll find it..
As you said that yours is java application , the user of your program should have java(JRE) installed on his computer inorder to run your program..
Question asked 2 years ago....
However , if your chat application(using sockets) works over intranet(LAN) successfully then it WILL and should work over internet also..
Check the source code whether the server and client IP's and port numbers are correct..
Straight question.
How to install windows xp in a system which is running windows 7. (without formatting windows 7).
DUAL boot
My purpose got satisfied..
When i first saw that question , i thought that it was a silly question but when i think deeply it's a kind of interesting , logical question. Eventhough i know the answer , just posted because to know different ideas and comments from you all people...
@Muralidharan.E... i like your straight forward answer....
@Majestics
That's what my main intention in posting this question..
I already know the answer that int has a range..
but how many times does it is looping and what exactly is the value of c ..
Can I expect an accurate explanation...
That's where the logic lies..
Your answer is correct theorotically but practically the answer is different ..
Observe the code carefully...
The loop will terminate .
..
I am a really such an ...:)
its a typo...
int c=10; (it is not c=1)
int c=10;
while(c>1)
{
c++;
}
System.out.println("loop over.");
If it was c=1 , it will be a idiotic question as i know..
Hi folks..
Can you tell how many times the loop is executed with exact reason.
int c=10;
while(c>1)
{
c++;
}
System.out.println("loop over.");
I am expecting an indepth answer...
@NormR1 I just gave the example to your explanation..
JOptionPane.showMessageDialog (null,"\nMY SALARY IS "+EN + "\n MY DEDUCTION is" +DR );
Humanity is the first responsibility of every citizen.
What you asked or said works 100% right....
If you dont know the code or logic of sorting technique , just google it and you'll find it..
Ok..
Read the user input (elements that are to be sorted ) into an array..
Then read the choice of the menu..
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int choice=Integer.parseInt(br.readLine());
Now using switch - case , write your actual sorting technique code in the appropriate cases.
switch(choice)
{
case 1:
{
//write your bubble sort logic here
break;
}
case 2:
{
//write your selection sort logic here
break;
}
case 3:
{
//write your insertion sort logic here
break;
}
}
Your question is not clear.
Specify what exactly you want to say..
Try this..
We can set class path from command prompt also..
Runtime r=Runtime.getRuntime();
r.exec("set classpath=your desired path");
What are the errors you got when compiled your code?..post them..
ya..forgot to add the source as i was keen to download it...
Great to hear that..
Java SE 7 is officially released today! After nearly five years of collaboration within the worldwide Java community, Java Platform, Standard Edition is ready for download! It's an important step in Java’s evolution. The major features of Java SE 7 are:
• Project Coin- many small language changes that add up to a big boost in productivity for developers
• The Fork/Join Framework - facilitates parallelism for mulit-core processors
• The New File System API (NIO.2) - provides the ability to perform many basic file system operations natively
• InvokeDynamic - makes it easier to run other languages on the JVM
Hi..
Well.. i am doing a project in J2ME .
I heard that j2me midlets cannot run on some of the (latest) mobile phones and there involves a hectic work to deploy them in mobile. Is that so? .
How to deploy my j2me midlet in mobile phone. ?
Copying the jar file (or jad file) into the mobile is only thing that i should do inorder to deploy my app?
My project is basically a banking application.
what are the minimum mobile requirements that i should have inorder to make my project work
successfully?
If a person is not happy , then it doesn't mean that he don't know happyness .
It is because life had tought him some lessons which made him like that.
"I studied every thing but never topped.... But today the toppers of the best universities are my employees"
— Bill Gates
why using 26 booleans and waste memory..?
Store the string into an char array and check the repetition using a loop..
The entire screen turns white color and images are not being displayed on the screen .
But the Jprogressbar and some text labels are being displayed.
The ImageIcon is not null .
Is there any other way to load the images ?
The code works even when i use absolute path.
Whether i use absolute path or entire path , the images are being loaded when i execute my program from my editor.
When i execute the same from a batch file or from command prompt , the images are not being loaded.
JLabel img=new JLabel(new ImageIcon("d:/myproject/image1.jpg"));
I also tried without abolute path as the image files and program is in same directory.
I have used printStackTrace and there are no error messages in my code.
Hi
I encountered a strange problem today when i tried to run my java program from a batch file.
I have a fullscreen mode java application and i tried to run the application from a batch file .Now the problem is images are not being loaded when i run my program using batch file.
I executed manually from the command prompt and was shocked to see that even now the problem is not fixed.
I generally use my favourate Editplus editor. When i execute from my editor,
there is no such problem and everything works fine.
I rec-checked the path of images twice and there's no problem with that.
I really dont know what's stopping the images from being loaded when i execute from batch file.
Its one of the reasons that I like java because there is no pointers concept and i am not bothered with dealing the addresses...
One of the great advantages of java is built-in memory allocation and management.
if java fail to clean the resources on close... kind of poor background for java.
There is no question of java failing to clean the resources.
Once the application is closed and JVM starts quitting ,JVM is responsible to clean the memory and all the space allocated for JVM will automatically be deleted from RAM.
JVM is responsible for calling the garbage collector and looking all that..
While in C we should take care of memory management which increases programmers overhead.
Closing the window is just like any other operation performed on it like opening,resizing,minimizng,maximizing etc..
Just assume that closing the window is like somewhat similar to hiding the window.
So here in this case ,we are performing an simple close operation on window but the reference to that object still exists unless we explicitily make it null.
It still contains the same reference as that of before closing the window.
Closing the window or disposing the window doens't mean destroying the JFrame object.
We can make visible the window even after destroying it.
As destroying a window or closing it is just a operation performed on the window.
The jframe contains the same reference as before even we destory the window...
Passing the exam will be easy but scoring more is what which shows the understanding of java.
Anyway...writing the exam may cost but preparation will cost nothing.
Preparation is what i was emphasizing from starting post and whether taking the exam or not is the secondary thing and depends on one's own interest. Perhaps we should take certification exam only if we feel we are strong technically(and ofcourse financially).
Technology costs. But knowledge doesn't ----Anonymous
off course, SCJP does no longer exist. the name has been changed when Oracle took Java over from Sun
Yeah..scjp still exists but its now OCJP..however the pattern and syllabus of the exam is the same except the name.
Its well known fact that the preparation for certification exams cannot be done in a week or two. If you think that you are a java nerd and you have very good basics then certification is an valuable option.
If you are more interested in java ,starting preparation for Oracle certification from an highschool onwards is a good option.
for(i=1;i<=num;i++)
If you want to check nearest prime numbers , then why checking it from i=1 onwards.
Checking from reverse manner i.e (i=num-1) whould be a better approach.
Anyway...here's the solution..
import java.io.*;
class Twin
{
public static void main(String[] args) throws Exception
{
int twin[]=new int[2],count=0,k=0;
System.out.println("Enter the range :");
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int range=Integer.parseInt(br.readLine().trim());
for(int i=range-1;i>=1;i--)
{
for(int j=2;j<i;j++)
{
if(i%j==0){count++;break;}
}
if(count==0)twin[k++]=i;
count=0;
if(k==2)break;
}
System.out.println("The twin primes are "+ twin[0] +" and " +twin[1]);
System.out.println("sum is "+(twin[0]+twin[1]));
}
}
There are so many online quiz programs of java. you can google it and try those.
some of the websites are..
www.blackbeltfactory.com
www.javaranch.com
If you are very good in java basic concepts , then try to prepare for Sun certified java programmer (SCJP) from now onwards...
He has amazing stuff but outdated too..
Apart from the fact that he wrote his own prototype programs, all the features are now coming as built-in in windows 7.
A product that’s difficult to figure out, inefficient to use, or poorly supported is not going to win much of a user base -Anonymous
Even i got the same problem some months back.
It is due to your internet connection settings in gtalk.
Click settings in gtalk and check connection option.
Make sure that Detect proxy automatically is checked
Why does "one" appear twice?
one appear twice because when the loop first executes with value 0 , case 0 is executed and also case 1 gets executed because there is no break after the case 0.
so now the output becomes
zero
one
Now , the i value is 1 . hence case 1 will be executed which prints one more "one"
finally the i value is 2 which makes case default case gets executed
Hence the output is
zero
one
one
Unknown number
I hope now you understand the reason why one printed twice..
just put a break statement after the 7th line and you will get your desired output.
You can create that view by using any programming language but the LOC makes difference..
If you are familiar, you can try with java or .NET .
There's no code in paint() method because there is no requirement.
I am not worried about exceptions here in this case since it has no complex code to throw
such Heavy Exceptions ..
However ..
The only point is that code in keyTyped() method is not updating the components to window .
Without seeing your code how can we comment?
import java.awt.*;
import java.net.*;
import java.io.*;
import javax.swing.JFrame;
import javax.swing.*;
import java.awt.event.*;
public class FullScreenTest extends JFrame implements KeyListener{
int click=0;
JProgressBar jp;
String file="scanning ...file";
FileInputStream fis;
BufferedReader br=null;
String currentFile;
JLabel win=new JLabel(new ImageIcon("win-logo.png"));
JLabel avast=new JLabel(new ImageIcon("my-logo.png"));
JLabel lab=new JLabel("c:\\documents\\virus.exe");
static MediaPanel mediaPanel;
public static void main(String[] args) {
DisplayMode displayMode;
if (args.length == 3) {
displayMode = new DisplayMode(
Integer.parseInt(args[0]),
Integer.parseInt(args[1]),
Integer.parseInt(args[2]),
DisplayMode.REFRESH_RATE_UNKNOWN);
}
else {
displayMode = new DisplayMode(800, 600, 16,
DisplayMode.REFRESH_RATE_UNKNOWN);
}
FullScreenTest test = new FullScreenTest();
test.run(displayMode);
}
private static final long DEMO_TIME = 900000;
public void run(DisplayMode displayMode) {
addKeyListener(this);
getContentPane().setBackground(Color.black);
setForeground(Color.white);
setFont(new Font("Dialog", 0, 24));
setLayout(new BorderLayout());
URL test=null;
try
{test=new URL("file:///C:/Users/Harinath/Desktop/myvideofile.mpg"); }catch(Exception ex1){}
FullScreenTest.mediaPanel = new MediaPanel( test );
// mediaPanel.setBounds(0,0,600,600);
add( mediaPanel ,BorderLayout.CENTER);
SimpleScreenManager screen = new SimpleScreenManager();
try {
screen.setFullScreen(displayMode, this);
try {
Thread.sleep(DEMO_TIME);
}
catch (InterruptedException ex) { }
}catch(Exception ew){}
finally {
screen.restoreScreen();
}
}
public void paint(Graphics g) {
}
public void keyTyped(KeyEvent e){
//JOptionPane.showMessageDialog(this,"why do u think it is not executing??");
/*************************** This code not working *************************************/
try{
FullScreenTest.mediaPanel.callStop(); /* callStop() method code is at end of the code */
remove(FullScreenTest.mediaPanel);
}catch(Exception eq){}
repaint();
invalidate();
setLayout(null);
try{
fis=new FileInputStream("exefiles.txt");
br=new BufferedReader(new InputStreamReader(fis));
}catch(Exception e3){}
jp=new JProgressBar();
jp.setBorderPainted(false);
jp.setStringPainted(false);
jp.setForeground(new Color(67,127,209));
jp.setBackground(Color.black);
lab.setForeground(new Color(184,188,212));
jp.setBounds(20,390,760,20);
add(jp);
lab.setBounds(20,430,700,28);
add(lab);
win.setBounds(10,10,150,150);
avast.setBounds(200,180,330,250);
add(win);
add(avast);
for(int i=0;i<=100;i++)
{jp.setValue(i);
try{
for(int count=1;count<=25;count++){
currentFile=br.readLine();
if(currentFile==null){br.reset();i=100; jp.setValue(100); break; }
lab.setText("Scanning...."+currentFile);Thread.sleep(20);}
}catch(Exception e7){}
}
try{
lab.setForeground(Color.cyan);
remove(jp);
lab.setText("SCAN COMPLETED SUCCESSFULLY....");
Thread.sleep(2500);
for(int u=10;u>=0;u--){ …