my project is IDE for java

Reply

Join Date: Apr 2007
Posts: 3
Reputation: suneetha is an unknown quantity at this point 
Solved Threads: 0
suneetha suneetha is offline Offline
Newbie Poster

my project is IDE for java

 
0
  #1
Apr 6th, 2007
hai friends my academic project is developing an editor for java. please tell me the code to compile and execute the java programme.
waiting for ur reply please
thanq
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 6,145
Reputation: jwenting is just really nice jwenting is just really nice jwenting is just really nice jwenting is just really nice 
Solved Threads: 212
Team Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: my project is IDE for java

 
0
  #2
Apr 6th, 2007
if you are incapable of reading the documentation that comes with the JDK (which will tell you how to compile something) and follow a basic tutorial (linked to from that documentation), what makes you think you can create anything in Java (let alone an IDE, a project usually involving dozens of experienced people and many months or even years of effort)?

I don't in fact think it's an "academic project" at all, sounds more like a homework assignment and you didn't pay attention in class...
As people are clearly allowed to attack me but I'm not allowed to defend myself, I no longer post to this site.
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 3
Reputation: suneetha is an unknown quantity at this point 
Solved Threads: 0
suneetha suneetha is offline Offline
Newbie Poster

Re: my project is IDE for java

 
0
  #3
Apr 6th, 2007
hello i have written all the code for creating editor. please see this and i stuck up with compiling and executing the programe
  1. import java.awt.*;
  2. import javax.swing.*;
  3. import javax.swing.text.*;
  4. import javax.swing.undo.*;
  5. import java.awt.event.*;
  6. import java.io.*;
  7. import java.lang.*;
  8. import java.util.regex.*;
  9. public class Editor1 extends JFrame implements ActionListener
  10. {
  11. static String select;
  12. BufferedReader br;
  13. JFileChooser fc;
  14. JMenuBar mb;
  15. JScrollPane js;
  16. JMenu file,edit,search,build,run,help;
  17. JMenuItem nw,open,save,saveAs,print,exit,undo,redo,cut,copy,paste,find,replace,goToLineNumber,compile,javadoc,execute;
  18. JTextArea ta;
  19. Font f;
  20. Container c,c1;
  21. String fname;
  22. public Editor1()
  23. {
  24. select=" ";
  25. br=new BufferedReader(new InputStreamReader(System.in));
  26. fc= new JFileChooser();
  27. //go to content pane
  28. c=getContentPane();
  29. //set BorderLayout to c
  30. c.setLayout(new BorderLayout());
  31. //create textarea
  32. ta=new JTextArea(100,100);
  33. //add ta to c
  34. c.add("West",ta);
  35. // creates a scrollbar
  36. js = new JScrollPane(ta,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
  37.  
  38. JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
  39. c.add(js);
  40. //ta.addActionListener(this);
  41. //set font
  42. f=new Font("sansserif",Font.PLAIN,17);
  43. ta.setFont(f);
  44. //create the menubar
  45. mb=new JMenuBar();
  46. //add mb to c
  47. c.add("North",mb);
  48. //create file,edit,search,build,run,help menus
  49. file=new JMenu("File");
  50. edit=new JMenu("Edit");
  51. search=new JMenu("Search");
  52. build=new JMenu("Build");
  53. run=new JMenu("Run");
  54. help=new JMenu("Help");
  55. //add menus to mb
  56. mb.add(file);
  57. mb.add(edit);
  58. mb.add(search);
  59. mb.add(build);
  60. mb.add(run);
  61. mb.add(help);
  62. //create menu items
  63. nw=new JMenuItem("New");
  64. open=new JMenuItem("Open");
  65. save=new JMenuItem("Save");
  66. saveAs=new JMenuItem("Save As");
  67. print=new JMenuItem("Print");
  68. exit=new JMenuItem("Exit");
  69. undo=new JMenuItem("Undo");
  70. redo=new JMenuItem("Redo");
  71. cut=new JMenuItem("Cut");
  72. copy=new JMenuItem("Copy");
  73. paste=new JMenuItem("Paste");
  74. find=new JMenuItem("Find");
  75. replace=new JMenuItem("Replace");
  76. goToLineNumber=new JMenuItem("Go to line number");
  77. compile=new JMenuItem("Compile");
  78. javadoc=new JMenuItem("Javadoc");
  79. execute=new JMenuItem("Execute");
  80. //add menuitems to menus
  81. file.add(nw);
  82. file.add(open);
  83. file.add(save);
  84. file.add(saveAs);
  85. file.addSeparator();
  86. file.add(print);
  87. file.add(exit);
  88. edit.add(undo);
  89. edit.add(redo);
  90. edit.addSeparator();
  91. edit.add(cut);
  92. edit.add(copy);
  93. edit.add(paste);
  94. search.add(find);
  95. search.add(replace);
  96. search.add(goToLineNumber);
  97. build.add(compile);
  98. build.add(javadoc);
  99. run.add(execute);
  100. nw.addActionListener(this);
  101. open.addActionListener(this);
  102. save.addActionListener(this);
  103. saveAs.addActionListener(this);
  104. print.addActionListener(this);
  105. exit.addActionListener(this);
  106. undo.addActionListener(this);
  107. redo.addActionListener(this);
  108. cut.addActionListener(this);
  109. copy.addActionListener(this);
  110. paste.addActionListener(this);
  111. find.addActionListener(this);
  112. replace.addActionListener(this);
  113. goToLineNumber.addActionListener(this);
  114. compile.addActionListener(this);
  115. javadoc.addActionListener(this);
  116. execute.addActionListener(this);
  117. //close the frame
  118. setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  119. }
  120. public void actionPerformed(ActionEvent ae)
  121. {
  122. //to know which item is selected
  123. try
  124. {
  125. if(nw.isArmed())
  126. {
  127. ta.setText(" ");
  128. this.setTitle("SMART JAVA EDITOR-UnTitle.java");
  129. }
  130. //end of new */
  131. if(open.isArmed())
  132. {
  133. int i=fc.showOpenDialog(this);
  134. if(i==JFileChooser.APPROVE_OPTION)
  135. {
  136. fname=fc.getSelectedFile().getName();
  137. FileReader fr=new FileReader(fname);
  138. BufferedReader br1=new BufferedReader(fr,1024);
  139. this.setTitle("SMART JAVA EDITOR-"+fname);
  140. String str;
  141. while(((str=br1.readLine()).length())!=-1)
  142. {
  143. ta.append(str+"\n");
  144. }
  145. br1.close();
  146. }
  147. } //end of open
  148. if(save.isArmed())
  149. {
  150. fname=getTitle();
  151. if(fname.equals("SMART JAVA EDITOR-Untitle.java"))
  152. {
  153. int i=fc.showSaveDialog(this);
  154. if(i==JFileChooser.APPROVE_OPTION)
  155. {
  156. fname=fc.getSelectedFile().getName();
  157. }
  158. }
  159. setTitle("SMART JAVA EDITOR-"+fname);
  160. String str;
  161. FileWriter fw=new FileWriter(fname);
  162. BufferedWriter bw=new BufferedWriter(fw,1024);
  163. str=ta.getText();
  164. for(int j=0;j<str.length();j++)
  165. {
  166. bw.write(str.charAt(j));
  167. }
  168. bw.close();
  169.  
  170. } //end of save
  171. if(saveAs.isArmed())
  172. {
  173. int i=fc.showSaveDialog(this);
  174. if(i==JFileChooser.APPROVE_OPTION)
  175. {
  176. fname=fc.getSelectedFile().getName();
  177. setTitle("SMART JAVA EDITOR-"+fname);
  178. String str;
  179. FileWriter fw=new FileWriter(fname);
  180. BufferedWriter bw=new BufferedWriter(fw,1024);
  181. str=ta.getText();
  182. for(int j=0;j<str.length();j++)
  183. {
  184. bw.write(str.charAt(j));
  185. }
  186. bw.close();
  187. }
  188. } //end of saveAs
  189. /*if(print.isArmed())
  190.   {
  191.   } //end of print*/
  192. if(exit.isArmed())
  193. {
  194. System.exit(0);
  195. } //end of exit
  196. /* if(undo.isArmed())
  197.   {
  198.   // UndoRedoDemo urd=new UndoRedoDemo(this.ta,"undo");
  199.   //ta.undo();
  200.   }*/
  201. /* if(redo.isArmed())
  202.   {
  203.   }*/
  204. if(cut.isArmed())
  205. {
  206. select=ta.getSelectedText();
  207. ta.cut();
  208. } //end of cut
  209. if(copy.isArmed())
  210. {
  211. ta.copy();
  212. select=ta.getSelectedText();
  213. } //end of copy
  214. if(paste.isArmed())
  215. {
  216. if(!(select.equals(" ")))
  217. ta.paste();
  218. } //end of paste
  219. if(find.isArmed())
  220. {
  221. FindDemo fd=new FindDemo(this.ta);
  222. } //end of find
  223. if(replace.isArmed())
  224. {
  225. ReplaceDemo rd=new ReplaceDemo(this.ta);
  226. } //end of replace
  227. if(goToLineNumber.isArmed())
  228. {
  229. GoToLineNumberDemo gd= new GoToLineNumberDemo(this.ta);
  230. } //end of goToLineNumber
  231. /* if(compile.isArmed())
  232.   {
  233.   Class c=Class.forName("sairam");
  234.   //String xxx="Editor1";
  235.   Boolean b=Compiler.compileClass(c);
  236.   System.out.println(b);
  237.   }*/ //end of compile
  238. /*if(javadoc.isArmed())
  239.   {
  240.   } //end of javadoc*/
  241. if(execute.isArmed())
  242. {
  243. Runtime rt=Runtime.getRuntime();
  244. Process prc=rt.exec(Editor1);
  245. InputStreamReader is=new InputStreamReader(prc.getInputStream());
  246. } //end of execute
  247. } //end of try
  248. catch(IOException ie)
  249. {
  250. } //end of catch
  251. catch(CannotUndoException be)
  252. {
  253. }
  254. catch(NullPointerException ne)
  255. {
  256. }
  257. catch(ClassNotFoundException c)
  258. {
  259. System.out.println("class");
  260. }
  261. } //end of paint()
  262. public static void main(String args[])throws IOException
  263. {
  264. //create the frame
  265. Editor1 e=new Editor1();
  266. e.setTitle("SMART JAVA EDITOR-Untitle.java");
  267. e.setSize(800,600);
  268. e.setVisible(true);
  269. }
  270. }
Last edited by ~s.o.s~; Apr 11th, 2007 at 12:59 pm. Reason: Added code tags. Learn to use them.
Reply With Quote Quick reply to this message  
Join Date: Mar 2004
Posts: 761
Reputation: Phaelax is on a distinguished road 
Solved Threads: 38
Phaelax Phaelax is online now Online
Master Poster

Re: my project is IDE for java

 
0
  #4
Apr 7th, 2007
Use code tags next time, nobody wants to look at unindented code.

Aside from using a few classes that the rest of us don't have and so we can't run it, all I really see so far is you've constucted the GUI.

For compiling and running classes, you'll really need to understand how to do it through the command prompt. Look up the docs on the Process and Runtime classes.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Java Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC