Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8303007
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T17:25:23+00:00 2026-06-08T17:25:23+00:00

getting an unusual error:- ‘void’ type not allowed here import javax.sound.midi.*; public class MiniMusicPlayer1

  • 0

getting an unusual error:- ‘void’ type not allowed here

import javax.sound.midi.*;

 public class MiniMusicPlayer1 {
    public static void main(String[] args) {
            try {
                    Sequencer player = MidiSystem.getSequencer();
                    Sequence seq = new Sequence(Sequence.PPQ, 4);
                    Track track = seq.createTrack();
                    for (int i = 5; i < 61; i += 4) {
                            track.add(makeEvent(144, 1, i, 100, i));
                            track.add(makeEvent(128, 1, i, 100, i));
                    }

                            player.setSequence(seq);
                            player.setTempoInBPM(220);
                            player.start();



            } catch (Exception ex) {
                    System.out.println(ex.printStackTrace());
            }
    }

    public static MidiEvent makeEvent(int comd, int ch, int note, int vel,
                    int tick) {
            MidiEvent event = null;
            try
            {
                    ShortMessage a = new ShortMessage();
                    a.setMessage(comd, ch, note, vel);
                    event = new MidiEvent(a,tick);

            }
            catch(Exception e)
            {
                    System.out.println(e.getMessage());
            }
            return event;
    }

ankit@battlestar:/home/mount_150/Java$ javac MiniMusicPlayer1.java
MiniMusicPlayer1.java:21: error: ‘void’ type not allowed here
System.out.println(ex.printStackTrace());
^

Please help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T17:25:25+00:00Added an answer on June 8, 2026 at 5:25 pm

    You’re calling printStackTrace and “passing” its void result to println.

    println requires something to print: all you need is ex.printStackTrace().

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Getting this weird LINQ error. title = System.Linq.Enumerable+WhereSelectEnumerableIterator`2[System.Xml.Linq.XElement,System.String Here is the code I have:
Here's an unusual json I'm getting from a web service. {SearchResults:[{PageCount:1}, {SEARCHVAL:Result,CATEGORY:Category1,X:1,Y:2}, {SEARCHVAL:AnotherResult,CATEGORY:Category1,X:2,Y:2}]} I'd
I am getting an unusual error when I try building or running my iphone
I am getting an unusual error while running my application, just wondering if anyone
Getting 'Dispatcher has no subscribers' error while trying to post message to a channel
Getting a strange error when trying to insert data into an Access database using
A client is running a web app through Tomcat and is getting an unusual
I published app at the Market and I keep getting error: Exception class: android.content.res.Resources$NotFoundException
I'm getting some unusual memory leak in a native c++ win32 application. It has
So I've used UITableView many times before but I'm getting some unusual behavior that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.