Sinisterly
How can I run this? - Printable Version

+- Sinisterly (https://sinister.li)
+-- Forum: Coding (https://sinister.li/Forum-Coding)
+--- Forum: Java, JVM, & JRE (https://sinister.li/Forum-Java-JVM-JRE)
+--- Thread: How can I run this? (/Thread-How-can-I-run-this)

Pages: 1 2


How can I run this? - Drugs - 11-13-2015

So I've made this program (chatbot) in Notepad++ and I don't really know how to run it.

Here it is if you wanna see the code:

Code:
import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JTextArea; import javax.swing.JScrollPane; import java.awt.Color; import java.awt.event.KeyListener; import java.awt.event.KeyEvent; import java.lang.Math; public class ChatBot extends JFrame implements KeyListener{ JPanel p=new JPanel(); JTextArea dialog=new JTextArea(20,50); JTextArea input=new JTextArea(1,50); JScrollPane scroll=new JScrollPane( dialog, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); String[][] chatBot={ //standard greetings {"zdravo","bok","cao","hej"}, {"Hej!","Zdravo!","Hej!"}, //question greetings {"kako si","kak si"}, {"Dobro sam","Super sam!"}, //yes {"da"}, {"ne","NE","NE!!!!!!!"}, //talk about music {"kakvu muziku slusas","kakvu glazbu volis","kakvu muziku volis","kakvu glazbu slusas"} {"slusam rock","obozavam rock&roll","fan sam rock&roll-a"} //sports {"kakve sportove volis","koje sportove igras","koje sportove volis"} {"igram nogomet, košarku, odbojku, rukomet, baseball, rugby i hokej"} //default {"zašuti","loš si","isuse","ajde, prestani pricati", "(Tinov Prijatelj nije dostupan zato što bari žene)"} }; public static void main(String[] args){ new ChatBot(); } public ChatBot(){ super("Chat Bot"); setSize(600,400); setResizable(false); setDefaultCloseOperation(EXIT_ON_CLOSE); dialog.setEditable(false); input.addKeyListener(this); p.add(scroll); p.add(input); p.setBackground(new Color(255,200,0)); add(p); setVisible(true); } public void keyPressed(KeyEvent e){ if(e.getKeyCode()==KeyEvent.VK_ENTER){ input.setEditable(false); //-----grab quote----------- String quote=input.getText(); input.setText(""); addText("-->Alen:\t"+quote); quote.trim(); while( quote.charAt(quote.length()-1)=='!' || quote.charAt(quote.length()-1)=='.' || quote.charAt(quote.length()-1)=='?' ){ quote=quote.substring(0,quote.length()-1); } quote.trim(); byte response=0; /* 0:we're searching through chatBot[][] for matches 1:we didn't find anything 2:we did find something */ //-----check for matches---- int j=0;//which group we're checking while(response==0){ if(inArray(quote.toLowerCase(),chatBot[j*2])){ response=2; int r=(int)Math.floor(Math.random()*chatBot[(j*2)+1].length); addText("\n-->Tinov Prijatelj\t"+chatBot[(j*2)+1][r]); } j++; if(j*2==chatBot.length-1 && response==0){ response=1; } } //-----default-------------- if(response==1){ int r=(int)Math.floor(Math.random()*chatBot[chatBot.length-1].length); addText("\n-->Tinov Prijatelj\t"+chatBot[chatBot.length-1][r]); } addText("\n"); } } public void keyReleased(KeyEvent e){ if(e.getKeyCode()==KeyEvent.VK_ENTER){ input.setEditable(true); } } public void keyTyped(KeyEvent e){} public void addText(String str){ dialog.setText(dialog.getText()+str); } public boolean inArray(String in,String[] str){ boolean match=false; for(int i=0;i<str.length;i++){ if(str[i].equals(in)){ match=true; } } return match; } }


I have JDK installed and everything is set up but I don't know how to run it.


RE: How can I run this? - The Real Slim Shady - 11-14-2015

(11-13-2015, 06:45 PM)Drugs Wrote: So I've made this program (chatbot) in Notepad++ and I don't really know how to run it.

Bullshit.

Theres no way you know Java well enough to code that... and yet not have a fucking clue on how to run it. Case in point... this is the same fucking code and it was posted 2 years ago:

https://www.moparscape.org/smf/index.php?topic=656180.0

Don't be a fucking douche.


RE: How can I run this? - Drugs - 11-14-2015

(11-14-2015, 01:11 AM)The Real Slim Shady Wrote: Bullshit.

Theres no way you know Java well enough to code that... and yet not have a fucking clue on how to run it. Case in point... this is the same fucking code and it was posted 2 years ago:

https://www.moparscape.org/smf/index.php?topic=656180.0

Don't be a fucking douche.

I didn't even say I made it... I did this with help from YouTube. Don't be an asshole... I've edited some parts myself and made it more home-feeling to myself.


RE: How can I run this? - Satan - 11-14-2015

(11-13-2015, 06:45 PM)Drugs Wrote: So I've made this program (chatbot) in Notepad++ and I don't really know how to run it.

(11-14-2015, 01:18 AM)Drugs Wrote: I didn't even say I made it... I did this with help from YouTube. Don't be an asshole... I've edited some parts myself and made it more home-feeling to myself.

What.

Also, have you Googled it or no?
If it's just that its not compiled, lol.


RE: How can I run this? - Drugs - 11-14-2015

(11-14-2015, 08:09 AM)Heart Wrote: What.

Also, have you Googled it or no?
If it's just that its not compiled, lol.

When saying "I made this program" I meant that I've personalized it enough to be something like my own program.

I haven't googled it, my friend showed me the tutorial.


RE: How can I run this? - The Real Slim Shady - 11-14-2015

(11-13-2015, 06:45 PM)Drugs Wrote: I've made this program

(11-14-2015, 01:18 AM)Drugs Wrote: I didn't even say I made it...

LOL

(11-14-2015, 11:25 AM)Drugs Wrote: I meant that I've personalized it enough to be something like my own program.

You've translated or changed some english text to slovenia. You haven't "made" anything. Especially since your too daft to figure out how to run Java code. It's not like one of the most used programming languages on the planet. it would take real talent to google how to compile a java application and not get extremely relevant results in the first 2 pages


RE: How can I run this? - Oni - 11-14-2015

Learn to compile.


RE: How can I run this? - Drugs - 11-14-2015

(11-14-2015, 02:38 PM)The Real Slim Shady Wrote: LOL


You've translated or changed some english text to slovenia. You haven't "made" anything. Especially since your too daft to figure out how to run Java code. It's not like one of the most used programming languages on the planet. it would take real talent to google how to compile a java application and not get extremely relevant results in the first 2 pages

1st of all: not "slovenia", it's Slovenian. This isn't in Slovenian as well. I know how to run fucking Java code, I'm not stupid. I know how to compile and run.

It can't find the mail class, which is the error message. Now go bitch to someone else, self-centered asshole.


RE: How can I run this? - The Real Slim Shady - 11-14-2015

(11-14-2015, 04:05 PM)Drugs Wrote: I know how to run fucking Java code, I'm not stupid.

Clearly you don't...

(11-14-2015, 04:05 PM)Drugs Wrote: It can't find the mail class, which is the error message.



RE: How can I run this? - Drugs - 11-14-2015

(11-14-2015, 04:18 PM)The Real Slim Shady Wrote: Clearly you don't...

What? It's really not hard:

javac [name].java
java [name]